| Procedure features: |
|
| Other features: |
|
| Sample library member: |
GR21N08
|
This example shows that when your data contain a classification
variable that groups the data, you can use a plot request of the form y-variable*x-variable=third-variable to generate
a separate plot for every formatted value of the classification variable,
which in this case is CITY. With this type of request, all plots are drawn
on the same graph and a legend is automatically produced and explains the
values of third-variable. The default legend uses the variable
name CITY for the legend label and the variable values for the legend value
descriptions. Because no LEGEND definition is used in this example, the font
and height of the legend label and the legend value descriptions are set by
the graphics options FTEXT= and HTEXT=. Height specifications in the SYMBOL
statement do not affect the size of the symbols in the legend values.
This example then modifies the plot request. As shown
in the following output, the plot is enhanced by using different symbol definitions
for each plot line, changing axes labels, and scaling the vertical axes
differently.
 | libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
colors=(black blue green red)
ftitle=swissb ftext=swiss htitle=6 htext=3; |
 | data reflib.citytemp;
input month faren city $;
datalines;
1 40.5 Raleigh
1 12.2 Minn
1 52.1 Phoenix
...more data lines...
12 41.2 Raleigh
12 18.6 Minn
12 52.5 Phoenix
; |
 | title1 'Average Monthly Temperature';
footnote1 j=l ' Source: 1984 American Express';
footnote2 j=l ' Appointment Book'
j=r 'GR21N08(a) '; |
 | symbol1 interpol=join
value=dot
height=3; |
 | proc gplot data=reflib.citytemp;
plot faren*month=city / hminor=0;
run; |
 | footnote2 j=l ' Appointment Book'
j=r 'GR21N08(b) '; |
 | symbol1 color=green interpol=spline
width=2 value=triangle
height=3;
symbol2 color=blue interpol=spline
width=2 value=circle
height=3;
symbol3 color=red interpol=spline
width=2 value=square
height=3; |
 | axis1 label=none
value=('JAN' 'FEB' 'MAR' 'APR' 'MAY' 'JUN'
'JUL' 'AUG' 'SEP' 'OCT' 'NOV' 'DEC')
offset=(2)
width=3;
axis2 label=('Degrees' justify=right 'Fahrenheit')
order=(0 to 100 by 10)
width=3; |
 | legend1 label=none value=(tick=1 'Minneapolis'); |
 | plot faren*month=city / haxis=axis1 hminor=0
vaxis=axis2 vminor=1
caxis=red legend=legend1;
run;
quit; |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.