|The PLOT Procedure|
When you submit a RUN statement, PROC PLOT executes all the statements submitted since the last PROC PLOT or RUN statement. Each group of statements is called a RUN group. With each RUN group, PROC PLOT begins a new page and begins with the first item in the VPERCENT= and HPERCENT= lists, if any.
To terminate the procedure, submit a QUIT statement, a DATA statement, or a PROC statement. Like the RUN statement, each of these statements completes a RUN group. If you do not want to execute the statements in the RUN group, use the RUN CANCEL statement, which terminates the procedure immediately.
You can use the BY statement interactively. The BY statement remains in effect until you submit another BY statement or terminate the procedure.
See Adjusting Labels on a Plot with the PLACEMENT= Option for an example of using RUN group processing with PROC PLOT.
|Generating Data with Program Statements|
Because PROC PLOT prints one character for each observation, using SAS program statements to generate the data set for PROC PLOT can enhance the effectiveness of continuous plots. For example, suppose that you want to generate data in order to plot the following equation, for x ranging from 0 to 100:
You can submit these statements:
options linesize=80; data generate; do x=0 to 100 by 2; y=2.54+3.83*x; output; end; run; proc plot data=generate; plot y*x; run;
If the plot is printed with a LINESIZE= value of 80, about 75 positions are available on the horizontal axis for the X values. Thus, 2 is a good increment: 51 observations are generated, which is fewer than the 75 available positions on the horizontal axis.
However, if the plot is printed with a LINESIZE= value of 132, an increment of 2 produces a plot with a space between each plotting symbol. For a smoother line, a better increment is 1, since 101 observations are generated.
|Labeling Plot Points with Values of a Variable|
If you are using pointer symbols and multiple points coincide, PROC PLOT uses the number of points as the plotting symbol if it is between 2 and 9. If it is more than 9, the procedure uses an asterisk.
Note: Because of character set differences among operating environments,
the pointer symbol for S=CENTER and V>0 may differ from the one shown here.
|not placing a blank||1||1||0-500|
|bad split, no split character specified||1||2||0-500|
|bad split with split character||50||3||0-500|
|free horizontal shift, fhs
|free vertical shift, fvs||1||5||0-500|
|vertical shift weight, vsw
|vertical/horizontal shift denominator, vhsd||5||7||1-500|
|(reserved for future use)||9-14|
|not placing the first character||11||15||0-500|
|not placing the second character||10||16||0-500|
|not placing the third character||8||17||0-500|
|not placing the fourth character||5||18||0-500|
|not placing the fifth through 200th character||2||19-214||0-500|
Index Values for Penalties contains the index values from Penalties Table with a description of the corresponding penalty.
|1||a nonblank character in the plot collides with an embedded blank in a label, or there is not a blank or a plot boundary before or after each label fragment.|
|2||a split occurs on a nonblank or nonpunctuation character when you do not specify a split character.|
|3||a label is placed with a different number of lines than the L= suboption specifies, when you specify a split character.|
|4-7||a label is placed far away from the corresponding point. PROC PLOT calculates
the penalty according to this (integer arithmetic) formula:
Notice that penalties 4 through 7 are actually just components of the formula used to determine the penalty. Changing the penalty for a free horizontal or free vertical shift to a large value such as 500 has the effect of removing any penalty for a large horizontal or vertical shift. Plotting Date Values on an Axis illustrates a case in which removing the horizontal shift penalty is useful.
|8||a label may collide with its own plotting symbol. If the plotting symbol is blank, a collision state cannot occur. See Collision States for more information.|
|15-214||a label character does not appear in the plot. By default, the penalty for not printing the first character is greater than the penalty for not printing the second character, and so on. By default, the penalty for not printing the fifth and subsequent characters is the same.|
Note: Labels can share characters without penalty.
penalties(15 to 20)=2 2 11 10 8 2
This example extends the penalty list. The twentieth penalty of 2 is the penalty for not printing the sixth through 200th character. When the last index i is greater than 18, the last penalty is used for the (i - 14)th character and beyond.
You can also extend the penalty list by just specifying the starting index. For example, the following PENALTIES= option is equivalent to the one above:
penalties(15)=2 2 11 10 8 2
Note: A collision state cannot occur if you do not use a plotting symbol.
When you overlay two or more label plots, all label plots are treated
as a single plot in avoiding collisions and computing hidden character counts.
Labels of different plots never overprint, even with the OVP system option
|n||number of points with labels|
|len||constant length of labels|
|s||number of label pieces, or fragments|
|p||number of placement states specified in the PLACE= option.|
Top of Page
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.