Sample 25583: Plotting two variables using PLOT statement
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 2, Chapter 21.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GPLVRBL1 |
| TITLE: GPLVRBL1-Plotting Two Variables |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS GOPTIONS GPLOT SYMBOLS |
| PROCS: GPLOT |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
+-------------------------------------------------------------+*/
/* Set the graphics environment */
goptions reset=all gunit=pct border cback=white
colors=(black blue green red)
ftext=swiss ftitle=swissb htitle=6 htext=4;
/* Create the data set STATS */
data stats;
input height weight;
datalines;
69.0 112.5
56.5 84.0
65.3 98.0
62.8 102.5
63.5 102.5
57.3 83.0
59.8 84.5
62.5 112.5
62.5 84.0
59.0 99.5
51.3 50.5
64.3 90.0
56.3 77.0
66.5 112.0
72.0 150.0
64.8 128.0
67.0 133.0
57.5 85.0
;
/* Define title and footnotes */
title 'Study of Height vs Weight';
footnote1 h=3 j=l ' Source: T. Lewis & L. R. Taylor';
footnote2 h=3 j=l ' Introduction to Experimental Ecology'
j=r 'GPLVRBL1(a) ';
/* Generate scatter plot */
proc gplot data= stats;
plot height*weight;
run;
footnote1;
footnote2 h=3 j=r 'GPLVRBL1(b) ';
/* Define symbol characteristics for second output graphic */
symbol1 interpol=rcclm95 /* regression analysis with */
/* confidence limits */
value=diamond /* plot symbol */
height=3 /* plot symbol height */
cv=red /* plot symbol color */
ci=blue /* regression line color */
co=green /* confidence limits color */
width=2; /* line width */
/* Generate scatter plot with regression */
plot height*weight / haxis=45 to 155 by 10
vaxis=48 to 78 by 6
hminor=1
regeqn;
run;
quit;

In this example, the PLOT statement uses a plot request of the type y-variable*x-variable to plot the variable HEIGHT against the variable WEIGHT. The second plot request specifies a regression analysis with confidence limits, and scales the range of values along the vertical and horizontal axes.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GPLOT
|
| Date Modified: | 2005-09-01 03:03:11 |
| Date Created: | 2005-05-23 14:17:04 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |