Previous Page | Next Page

The PLOT Procedure

PROC PLOT Statement


Reminder: You can use data set options with the DATA= option. See Data Set Options for a list.

PROC PLOT <option(s)>;

Task Option
Specify the input data set DATA=
Control the axes

Include missing character variable values MISSING

Exclude observations with missing values NOMISS

Uniformly scale axes across BY groups UNIFORM
Control the appearance of the plot

Specify the characters that construct the borders of the plot FORMCHAR=

Suppress the legend at the top of the plot NOLEGEND

Specify the aspect ratio of the characters on the output device VTOH=
Control the size of the plot

Specify the percentage of the available horizontal space for each plot HPERCENT=

Specify the percentage of the available vertical space for each plot VPERCENT=


Options

DATA=SAS-data-set

specifies the input SAS data set.

Main discussion: See Chapter 2, "Fundamental Concepts for Using Base SAS Procedures."
FORMCHAR <(position(s))>='formatting-character(s)'

defines the characters to use for constructing the borders of the plot.

position(s)

identifies the position of one or more characters in the SAS formatting-character string. A space or a comma separates the positions.

Default: Omitting (position(s)) is the same as specifying all twenty possible SAS formatting characters, in order.
Range: PROC PLOT uses formatting characters 1, 2, 3, 5, 7, 9, and 11. The following table shows the formatting characters that PROC PLOT uses.

Position Default Used to draw
1 | vertical separators
2 - horizontal separators
3 5 9 1 1 - corners
7 + intersection of vertical and horizontal separators

formatting-character(s)

lists the characters to use for the specified positions. PROC PLOT assigns characters in formatting-character(s) to position(s), in the order that they are listed. For example, the following option assigns the asterisk (*) to the third formatting character, the pound sign (#) to the seventh character, and does not alter the remaining characters:

formchar(3,7)='*#'
Interaction: The SAS system option FORMCHAR= specifies the default formatting characters. The system option defines the entire string of formatting characters. The FORMCHAR= option in a procedure can redefine selected characters.
Tip: You can use any character in formatting-characters, including hexadecimal characters. If you use hexadecimal characters, then you must put x after the closing quotation mark. For example, the following option assigns the hexadecimal character 2D to the third formatting character, the hexadecimal character 7C to the seventh character, and does not alter the remaining characters:
formchar(3,7)='2D7C'x
Tip: Specifying all blanks for formatting-character(s) produces plots with no borders, for example
formchar (1,2,7)=''
HPERCENT=percent(s)

specifies one or more percentages of the available horizontal space to use for each plot. HPERCENT= enables you to put multiple plots on one page. PROC PLOT tries to fit as many plots as possible on a page. After using each of the percent(s), PROC PLOT cycles back to the beginning of the list. A zero in the list forces PROC PLOT to go to a new page even if it could fit the next plot on the same page.

hpercent=33

prints three plots per page horizontally; each plot is one-third of a page wide.

hpercent=50 25 25

prints three plots per page; the first is twice as wide as the other two.

hpercent=33 0

produces plots that are one-third of a page wide,; each plot is on a separate page.

hpercent=300

produces plots three pages wide.

At the beginning of every BY group and after each RUN statement, PROC PLOT returns to the beginning of the percent(s) and starts printing a new page.

Alias: HPCT=
Default: 100
Featured in: Producing Multiple Plots per Page
MISSING

includes missing character variable values in the construction of the axes. It has no effect on numeric variables.

Interaction: overrides the NOMISS option for character variables
NOLEGEND

suppresses the legend at the top of each plot. The legend lists the names of the variables being plotted and the plotting symbols used in the plot.

NOMISS

excludes observations for which either variable is missing from the calculation of the axes. Normally, PROC PLOT draws an axis based on all the values of the variable being plotted, including points for which the other variable is missing.

Interaction: The HAXIS= option overrides the effect of NOMISS on the horizontal axis. The VAXIS= option overrides the effect on the vertical axis.
Interaction: NOMISS is overridden by MISSING for character variables.
Featured in: Excluding Observations That Have Missing Values
UNIFORM

uniformly scales axes across BY groups. Uniform scaling enables you to directly compare the plots for different values of the BY variables.

Restriction: You cannot use PROC PLOT with the UNIFORM option with an engine that supports concurrent access if another user is updating the data set at the same time.
VPERCENT=percent(s)

specifies one or more percentages of the available vertical space to use for each plot. If you use a percentage greater than 100, then PROC PLOT prints sections of the plot on successive pages.

Alias: VPCT=
Default: 100
Featured in: Producing Multiple Plots per Page
See also: HPERCENT=
VTOH=aspect-ratio

specifies the aspect ratio (vertical to horizontal) of the characters on the output device. aspect-ratio is a positive real number. If you use the VTOH= option, then PROC PLOT spaces tick marks so that the distance between horizontal tick marks is nearly equal to the distance between vertical tick marks. For example, if characters are twice as high as they are wide, then specify VTOH=2.

Minimum: 0
Interaction: VTOH= has no effect if you use the HSPACE= and the VSPACE= options in the PLOT statement.
See also: HAXIS= for a way to equate axes so that the given distance represents the same data range on both axes.

Previous Page | Next Page | Top of Page