SAS.GRAPH 9.1 Reference, Volumes I and II

The SYMBOL statement defines the characteristics of symbols that display the data plotted by a PLOT statement used by PROC GBARLINE, PROC GCONTOUR, and PROC GPLOT.

Used by:

Global

Assigned by default

Description

SYMBOL statements create SYMBOL definitions, which are used by the GPLOT and GCONTOUR procedures. For the GPLOT procedure, SYMBOL definitions control

For the GCONTOUR procedure, SYMBOL definitions control

If you create SYMBOL definitions, they are automatically applied to a graph by the procedure. If you do not create SYMBOL definitions, these procedures generate default definitions and apply them as needed to your plots.

Syntax

< SYMBOL <1...255>

appearance-options can be one or more of these:

BWIDTH= box-width

CI= line-color

CO= color

CV= value-color

FONT= font

HEIGHT= symbol-height < units >

LINE= line-type

POINTLABEL<=( label-description(s) ) NONE>

VALUE= special-symbol text-string NONE

WIDTH= thickness -factor

interpolation-option can be one of these:

Options

When the syntax of an option includes units , use one of these:

CELLS

character cells

CM

centimeters

IN

inches

PCT

percentageofthegraphicsoutputarea

PT

points.

If you omit units , a unit specification is searched for in this order:

  1. the GUNIT= option in a GOPTIONS statement

  2. the default unit, CELLS.

BWIDTH= box-width

CI= line-color

CO= color

COLOR= symbol-color

C= symbol-color

CV= value-color

FONT= font

F= font

HEIGHT= symbol-height < units >

H= symbol-height < units >

INTERPOL=BOX< option(s) ><00...25>

I=BOX< option(s) ><00...25>

INTERPOL=HILO<C>< option >

I=HILO<C>< option >

INTERPOL=JOIN

I=JOIN

INTERPOL=L< degree ><P><S>

I=L< degree ><P><S>

INTERPOL= map/plot-pattern

I= map/plot-pattern

INTERPOL=NEEDLE

I=NEEDLE

INTERPOL=NONE

I=NONE

INTERPOL=R< type ><0><CLM CLI<50...99>>

I=R< type ><0><CLM CLI<50...99>>

INTERPOL=SM< nn ><P><S>

I=SM< nn ><P><S>

INTERPOL=SPLINE<P><S>

I=SPLINE<P><S>

INTERPOL=STD<1 2 3>< variance >< option(s) >

I=STD<1 2 3>< variance >< option(s) >

INTERPOL=STEP< placement ><J><S>

I=STEP< placement ><J><S>

LINE= line-type

L= line-type

MODE=EXCLUDE INCLUDE

POINTLABEL<=( label-description(s) ) NONE>

REPEAT= number-of-times

R= number-of-times

SINGULAR= n

STEP= distance < units >

VALUE= special-symbol text-string NONE

WIDTH= thickness-factor

W= thickness-factor

Using the SYMBOL Statement

A SYMBOL statement specifies one or more options that indicate the color and other attributes used by the GPLOT procedure or the GCONTOUR procedure. For GPLOT, the main attributes include the plot symbol, interpolation method, and type of plot line. For GCONTOUR, the main attributes include the type of contour lines used and the text used to label those lines.

Note: SYMBOL statements can only be applied to contour plots when the AUTOLABEL option is specified on GCONTOUR.

You can define up to 99 different SYMBOL statements. A SYMBOL statement without a number is treated as a SYMBOL1 statement.

SYMBOL definitions can be defined anywhere in your SAS program. They are global and remain in effect until canceled or until you end your SAS session. Once defined, SYMBOL definitions can be

SYMBOL statements generate one or more symbol definitions, depending on how color is used and whether a plot symbol or type of contour line is specified. For more information, see Controlling Consecutive SYMBOL Statements on page 203 and Using Generated Symbol Sequences on page 208.

Although it is common practice, you do not have to start with SYMBOL1, and you do not have to use sequential statement numbers . When assigning SYMBOL definitions, SAS/GRAPH software starts with the lowest -numbered definition and works upward, ignoring gaps in the numbering.

Altering or Canceling SYMBOL Statements

SYMBOL statements are additive. If you define a SYMBOL statement and later submit another SYMBOL statement with the same number, the new SYMBOL statement defines or cancels only the options that are included in the new statement. Options that are not included in the new statement are not changed and remain in effect.

Assume you define SYMBOL4 as:

symbol4 value=star cv=red height=4;

The following statement cancels only HEIGHT= without affecting the rest of the definition:

symbol4 height=;

Add or change options in the same way. This statement adds an interpolation method to SYMBOL4:

symbol4 interpol=join;

This statement changes the color of the plot symbol from red to blue:

symbol4 cv=blue;

After all these modifications, SYMBOL4 has these characteristics:

symbol4 value=star cv=blue interpol=join;

Cancel individual SYMBOL statements by defining a SYMBOL statement of the same number without options (a null statement):

symbol4;

Canceling one SYMBOL statement does not affect any other SYMBOL definitions. To cancel all current SYMBOL statements, use RESET= in a GOPTIONS statement:

goptions reset=symbol;

Specifying RESET=GLOBAL or RESET=ALL cancels all current SYMBOL definitions as well as other settings.

To display current SYMBOL definitions in the LOG window, use the GOPTIONS procedure with the SYMBOL option:

proc goptions symbol nolist; run;

Controlling Consecutive SYMBOL Statements

If you specify consecutively numbered SYMBOL statements and you want SAS/GRAPH to use each definition only once, use color specifications to ensure each SYMBOL statement generates only one symbol definition. You can

For more information on specifying colors for symbol definitions, see Using Color on page 206.

If you do not use color to limit a SYMBOL statement to a single symbol definition, SAS/GRAPH generates multiple symbol definitions from that statement by rotating the current definition through the colors list (for more details, see Using Generated Symbol Sequences on page 208). Because SAS/GRAPH uses symbol definitions in the order they are generated, this means that the n th symbol definition applied to a graph does not necessarily correspond to the SYMBOL n statement.

For example, assuming no color is specified on the CSYMBOL= graphics option, these statements generate four definitions:

goptions colors=(red blue green); symbol1 value=star; symbol2 value=square color=yellow;

Because no color is specified on SYMBOL1, SAS/GRAPH rotates the symbol definition through the colors list, which has three colors. Thus, SYMBOL1 defines the first three applied symbol definitions, and SYMBOL2 defines the 4th:

Sequence Number

Source

Characteristics: Color

Symbol

1

SYMBOL1

red

star

2

SYMBOL1

blue

star

3

SYMBOL1

green

star

4

SYMBOL2

yellow

square

In this case, if a graph needs only three symbols, the SYMBOL2 definition is not used.

To make the n th applied symbol definition correspond to the SYMBOL n statement, limit each SYMBOL statement to a single color, using one of the techniques listed at the beginning of this section.

Setting Definitions for PROC GPLOT

The following topics apply only for SYMBOL statements used with PROC GPLOT:

Specifying Plot Symbols

The VALUE= option specifies the plot symbols that PROC GPLOT uses to mark the data points on a plot. Plot symbols can be

By default, the plot symbol is the + symbol. To specify a special symbol, use VALUE= to specify a name or a character from Figure 7.21 on page 202:

symbol1 value=hash color=green; symbol2 value=) color=blue;

This example uses color to ensure each SYMBOL statement generates only one definition. You can omit color specifications to let SAS/GRAPH rotate symbol definitions through the colors list. For details, see Using Generated Symbol Sequences on page 208.

To use plot symbols other than those in Figure 7.21 on page 202, use the FONT= option to specify a font for the plot symbol. If the font is a symbol font, such as Marker, the string specified with the VALUE= option is the character code for the symbol to be displayed. If the font is a text font, the string specified with VALUE= is displayed as the plot symbol. (See VALUE= on page 199 and FONT= on page 186.)

This table illustrates some of the ways you can define a plot symbol:

Definition

Plot Symbol

symbol1 value=plus;

symbol2 value=+;

symbol3 font=swiss value=plus;

plus

symbol4 font=marker value=U;

– 

symbol5value=" ";

Specifying a Default Interpolation Method

The INTERPOL= option in a GOPTIONS statement specifies a default interpolation method to be used with all SYMBOL definitions. This default interpolation method is in effect unless you specify a different interpolation in a SYMBOL statement. If the GOPTIONS statement does not specify an interpolation method, the default for each SYMBOL statement is NONE.

Sorting Data with Spline Interpolation

If you want the GPLOT procedure to sort by the horizontal axis variable before plotting, add the letter S to the end of any of the spline interpolation methods (INTERPOL=L, INTERPOL=SM, and INTERPOL=SPLINE). For example, suppose you want to overlay three plots (Y1*X1, Y2*X2, and Y3*X3) and for each plot, you want the X variable sorted in ascending order. Use these statements:

symbol1 i=splines c=red; symbol2 i=splines c=blue; symbol3 i=splines c=green; proc gplot; plot y1*x1 y2*x2 y3*x3 / overlay; run;

Using Color

Generally, there are two ways to explicitly specify color for SYMBOL statements:

You can also let SAS/GRAPH rotate symbol definitions through the colors list. For details, see Using Generated Symbol Sequences on page 208.

Specifying Colors with SYMBOL Statements

The SYMBOL statement has these options for specifying color:

CV= and CI= have the same effect as using COLOR= when they are used in these ways:

In general, CI=, CV=, and CO= color specific areas of the symbol. Use these options to produce symbols and plot lines of different colors without having to overlay multiple plot pairs. For example, if you request regression analysis with confidence limits, use this statement to assign red to the plot symbol, blue to the regression lines, and green to the confidence limit lines:

symbol cv=red ci=blue co=green;

The COLOR= option colors the entire symbol or those portions of it not colored by one of the other color options. If COLOR= precedes CI= or CV=, the CI= or CV= specification is used instead. If none of the SYMBOL color options is used, color specifications are searched for in this order:

  1. the CSYMBOL= option in a GOPTIONS statement

  2. each color in the colors list sequentially before the next SYMBOL definition is used.

CAUTION:

If the SYMBOL color options and the CSYMBOL= graphics option are not used, the SYMBOL definition cycles through each color in the colors list before the next definition is used. For details, see Using Generated Symbol Sequences on page 208.

Specifying Color with CSYMBOL=

The CSYMBOL= option on the GOPTIONS statement specifies the default color to be used by all SYMBOL definitions:

goptions csymbol=green; symbol1 value=star; symbol2 value=square;

In this example, both SYMBOL statements use green.

CSYMBOL= is overridden by any of the SYMBOL statement color options. See Using Color on page 206 for details.

If more SYMBOL definitions are needed, SAS/GRAPH returns to generating default symbol sequences.

Specifying Line Types

To specify the type of line for plot or contour lines, use the LINE= option to specify a number from 1 through 46. Figure 7.22 on page 208 shows the line types represented by these numbers. By default, the line type is 1 for plot and contour lines, and 2 for confidence limit lines.

Note: These line types are also used by other statements and procedures. Some options accept a line type of 0, which produces no line.

Using Generated Symbol Sequences

Symbol sequences are sets of SYMBOL definitions that are automatically generated by SAS/GRAPH software if any of these conditions is true:

If REPEAT= is also used, the resulting SYMBOL definition is repeated the specified number of times.

Default Symbol Sequences

Default symbol sequences are generated by rotating symbol definitions through the current colors list.

Each time a default definition is required, SAS/GRAPH takes the first default plot symbol or line type and uses it with the first color in the colors list. If more than one definition is required, it uses the same plot symbol or line type with the next color in the colors list and continues until all the colors have been used once. If more definitions are needed, SAS/GRAPH selects the second default plot symbol or line type and rotates it through the colors list. It continues in this fashion, selecting default plot symbols or line types and cycling them through the colors list until all the required definitions are generated.

If a color has been specified with the CSYMBOL= option on the GOPTIONS statement, each default plot symbol or line type is used once with the specified color, and the colors in the colors list are ignored.

Symbol Sequences Generated from SYMBOL Statements

If a SYMBOL statement does not specify color, and if the CSYMBOL= graphics option is not used, the symbol definition is rotated through every color in the colors list before the next SYMBOL definition is used:

goptions colors=(blue red green); symbol1 cv=red i=join; symbol2 i=spline v=dot; symbol3 cv=green v=star;

Here, the SYMBOL1 statement generates the first SYMBOL definition. The SYMBOL2 statement does not include color, so the first default plot symbol is rotated through all colors in the colors list before the SYMBOL3 statement is used. This table shows the colors and symbols that would be used if nine symbol definitions were required for PROC GPLOT:

Sequence Number

 

Characteristics:

 

Source

Color

Symbol

Interpolation

1

SYMBOL1

cv=red

first default

join

2

SYMBOL2

color=blue

dot

spline

3

SYMBOL2

color=red

dot

spline

4

SYMBOL2

color=green

dot

spline

5

SYMBOL3

cv=green

star

NONE

6

first default

color=blue

first default

default

7

first default

color=red

first default

default

8

first default

color=green

first default

default

9

second default

color=blue

second default

default

Notice that after the SYMBOL statements are exhausted, the procedure begins using the default definitions (sequences 6 through 9). Each plot symbol from the default list is rotated through all colors in the colors list before the next plot symbol is used. Also, SYMBOL1 does not specify a plot symbol, so the default sequencing provides the first default symbol (a + sign). When sequencing resumes in sequence number 6, it starts at the beginning again, selecting the first default plot symbol and rotating it through the colors list.

If you use REPEAT= but no color, the sequence generated by cycling the definition through the colors list is repeated the number of times specified by REPEAT=. For example, these statements define a colors list and illustrate the effect of REPEAT= on SYMBOL statements both with and without explicit color specifications:

goptions colors=(blue red green); symbol1 color=gold repeat=2; symbol2 value=star color=cyan; symbol3 value=square repeat=2;

Here, SYMBOL1 is used twice, SYMBOL2 is used once, and SYMBOL3 rotates through the list of three colors and then repeats this cycle a second time:

Sequence Number

 

Characteristics:

 

Source

Color

Symbol

Interpolation

1

SYMBOL1

gold

first default

default

2

SYMBOL1

gold

first default

default

3

SYMBOL2

cyan

star

default

4

SYMBOL3

blue

square

default

5

SYMBOL3

red

square

default

6

SYMBOL3

green

square

default

7

SYMBOL3

blue

square

default

8

SYMBOL3

red

square

default

9

SYMBOL3

green

square

default

[**] Pizer, Stephen M. (1975), Numerical Computing and Mathematical Analysis , Chicago: Science Research Associates, Inc., Chapter 4.

Категории