Chapter Contents

Previous

Next
The GPLOT Procedure

Example 4: Plotting Two Variables


Procedure features:
PLOT statement options:
HAXIS=
HMINOR=
REGEQN
VAXIS=
Other features:
RUN-group processing
SYMBOL statement
Sample library member: GR21N04

[IMAGE]

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 plot shows that weight generally increases with size.

This example then requests the same plot with some modifications. As shown by the following output, the second plot request specifies a regression analysis with confidence limits, and scales the range of values along the vertical and horizontal axes. It also displays the regression equation specified for the SYMBOL statement. Because the procedure supports RUN-group processing, you do not have to repeat the PROC GPLOT statement to generate the second plot.

[IMAGE]

 Note about code
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=4;
 Note about code
data reflib.stats;
   input height weight;
   datalines;
69.0  112.5
56.5   84.0
...more data lines...
67.0  133.0
57.5   85.0
;
 Note about code
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 'GR21N04(a) ';
 Note about code
proc gplot data=reflib.stats;
   plot height*weight;
run;
 Note about code
footnote1; /* this clears footnote1 */
footnote2 h=3 j=r 'GR21N04(b) ';
 Note about code
symbol1 interpol=rcclm95
       value=diamond
       height=3
       cv=red
       ci=blue
       co=green
       width=2;
 Note about code
   plot height*weight / haxis=45 to 155 by 10
                        vaxis=48 to 78 by 6
                        hminor=1
                        regeqn;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.