This is a summary of common commands for SAS-Graph

  • Doc File 27.50KByte

This is a summary of common commands for SAS-Graph. Each paragraph below begins with a keyword, which then can be followed on the same SAS line with the options described after it.

Symboln defines plotting symbols, and controls markers and interpolated lines in proc gplot. To control point markers, use v=value (leave value blank for none). You can put a character in quotes, or use shape names like dot, star, plus, square, diamond, or triangle. You can also change the color with c=color, the font with f=font, and the size of the marker with h=height. To control the interpolation line, use i=interpolationmethod. Some methods available are join (line segments), needle, spline, and regression (see below). You can control the type of line with l=n, where 1 gives a solid line and higher numbers give various dashed lines. You can control the width of the line with w=width.

The regression line command is made up of a coded sequence. It starts with i=r. The next character is l for linear, q for quadratic, or c for cubic. So i=rq will fit a parabola to your data. This may be followed by a zero if you want a zero intercept term, then cli or clm (confidence limits for prediction or for the mean) with a number for your confidence level. So for example, i=rlcli90 prints a linear regression line with non-zero intercept, and 90% confidence limits of prediction. The i=spline option joins points with curves. There are several variations (see documentation) but an important feature is that you can add an s (for sort) if your x variables are not in order, because otherwise points are joined in order they appear in the data set. (This only works for the spline option.)

Axisn statements define axes that are referenced in gplot or other procedures.

Order=(l to u by s) causes the axis values to start at l, end at u, and be separated by s. If you have character values, you can specify their order like this: order=(“c” “b” “a”). If you want a label for your axis, other than the variable name or label from the data set, you can specify it with label=(“label text”). Label=none suppresses any label. You can also specify what to label the major tick marks, for example, value=(“First” “Second” “Third”). The labeling will start at the lowest tick mark, and will go back to default values if you don’t have enough. Length=n units specifies the length of the axis. Units is optional, and will default to what is specified in goptions or the system default. Values are described under goptions, Offset=(n,m) is useful when points are too close to the axes or space is needed for aesthetic reasons. The first parameter leaves space at the bottom (left), the second at the top (right). Units can be specified, as with length, or the default will apply.

Goptions is used to set various defaults for the session. For example, if you want to specify your graph sizes using inches, say gunit=in (other choices are cm for centimeters, or pct for percent of display area, or cell for character cell units). Some of the other parameters used in axis and symbol statements can be set here too (see documentation). Goptions is also used to specify the creation of graphics files. The following commands are needed to produce a graphics file:

filename grafout 'drive:\path\filename.ext';

goptions device=driver-name gsfname=grafout gsfmode=replace;

Where driver-name is something like “gif” or “jpeg” (see help for complete list). These commands will cause the replacement of the file every time a graph is created. If you want to save multiple graphs, try

filename grafout 'drive:\path\';

goptions device=driver-name gsfname=grafout gsfmode=replace;

The graphs do not display in windows first, however. To set the display back to windows use device=win. You can also save any graph displayed in the windows environment by going to the file menu and exporting it.


Online Preview   Download