PATTERN Statement

You can use PATTERN statements to define colors and patterns in PROC GCHART, PROC GCONTOUR, PROC GMAP, and PROC GPLOT. You can use PATTERN statements anywhere in your SAS program. SAS/GRAPH software uses any PATTERN statements specified and, if more are needed, default PATTERN statements are used. [SAS/GRAPH User's Guide 56-60]

PATTERN Statements with PROC GCHART

If your PROC GCHART statements do not include a SUBGROUP= or a PATTERNID= specification, the color and pattern specified in your PATTERN1 statement are used for the bars or blocks produced by PROC GCHART.

If your PROC GCHART statements include a SUBGROUP= or a PATTERNID= specification, you can specify a PATTERN statement for each value of the SUBGROUP= variable. The values of this variable are sorted, and the color and pattern specified in the PATTERN1 statement are assigned to the first value; the color and pattern in the PATTERN2 statements are assigned to the second value; and so on.

PATTERN Statements with PROC GCONTOUR

If you want PROC GCONTOUR to fill each contour level with colors and patterns, specify the PATTERN option in the PLOT statement and a PATTERN statement for each level of contour. The procedure uses the PATTERN1 statement to fill the first contour level, the PATTERN2 statement to fill the second contour level, and so on.

PATTERN Statements with PROC GMAP

If you are producing a choropleth, block, or prism map, you can specify a PATTERN statement for each level of the response variable. The number of levels of the response variable can be
1+3.3 log (N)

where N is the number of ID values, if none of the above options is specified.

PATTERN Statements with PROC GPLOT

If you are plotting lines and want to fill the area under each curve, specify the AREAS= option in the PLOT statement and a PATTERN statement to fill the first region (beginning at the horizontal axis). Specify the AREAS= option and a PATTERN2 statement to fill the area above the first region, and so on.

PATTERN statement specification

The general form of a PATTERN statement is
   PATTERNn options;
where
n
is a number ranging from 1 to 30. If you do not specify a number after the keyword PATTERN, PATTERN1 is assumed.

options
allow you to specify the colors and patterns used to fill the bars, pies, maps, and other designs in your output.

The options used with PATTERN statements are described below.

COLOR=color
C=color
specifies the color to use for the bar, subgroup, or unit area of a plot. If C= is omitted from a PATTERN statement, the procedure uses the pattern specified by V= (see below) with each color in the COLORS= list before it uses the next PATTERN statement.

VALUE=value
V=value
specifies the pattern to use for the bar, subgroup, or unit area of a plot. [SAS/GRAPH User's Guide: pg. 58]

In a PATTERN statement if you specify a value for V= but not for C=, the procedure uses the pattern specified for V= with each color in the COLORS= list before it uses the next PATTERN statement.

If you are using PROC GCONTOUR, PROC GMAP, or PROC GPLOT, you can specify V=S or V=E, or one of the Mxxxxx values.

     M x x x x x
         1
         2
         3
         4
         5
          X
            starting angle

Using the Mxxxxx values, you can specify several densities of filling, either single lines or crosshatched lines, and the angle of the line.

REPEAT=number
R=number
specifies the number of times the PATTERN statement is to be reused. You can use the REPEAT= option in the statement to repeat the pattern before going to the next pattern.

Remember that if you omit the COLOR= option from the PATTERN statement, SAS/GRAPH repeats the pattern for each color in the current COLORS= list. If the R= option is used in a PATTERN statement from which the C= option is omitted, the statement cycles through the COLORS= list the number of times given by R=.

PATTERN statements are additive; if you specify a C= or V= option in PATTERN statement and then omit that option in a later PATTERN statement ending in the same number, the option remains in effect. To turn off options specified in a previous PATTERNn statement, either specify all options in a new PATTERNn statement, or use the keyword PATTERNn followed by a semicolon.

You can reset options in PATTERN statements to their default values by specifying a null value. A comma can be used (but is not required) to separate a null parameter from the next option.

Prepared by Michael Friendly
Email<friendly@yorku.ca>
Last Updated:Friday, July 19, 1995

[Previous] Previous Document. [Next] Next Document.