Chapter Contents

Previous

Next
The GPLOT Procedure

Example 6: Generating an Overlay Plot


Procedure features:
PLOT statement options:
LEGEND=
OVERLAY
Other features:
LEGEND statement
SYMBOL statement
Data set: REFLIB.STOCKS
Sample library member: GR21N06

[IMAGE]

In this example, one PLOT statement plots both the HIGH and LOW variables against the variable YEAR using two plot requests. The OVERLAY option on the PLOT statement determines that both plot lines appear on the same graph. The other PLOT options scale the vertical axis, add a reference line to the plot, and specify the number of minor tick marks on the axes. The SYMBOL, AXIS,and LEGEND statements modify the plot symbols, axes, and legend.

Note:   If the OVERLAY option were not specified, each plot request would generate a separate graph.  [cautionend]

 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
title1 'Dow Jones Yearly Highs and Lows';
footnote1 h=3 j=l ' Source: 1997 World Almanac'
          j=r 'GR21N06 ';
 Note about code
symbol1 color=red
        interpol=join
        value=dot
        height=3;
symbol2 font=marker value=C
        color=blue
        interpol=join
        height=2;
 Note about code
axis1 order=(1955 to 1995 by 5) offset=(2,2)
      label=none
      major=(height=2) minor=(height=1)
      width=3;

axis2 order=(0 to 6000 by 1000) offset=(0,0)
      label=none
      major=(height=2) minor=(height=1)
      width=3;
 Note about code
legend1 label=none
        shape=symbol(4,2)
        position=(top center inside)
        mode=share;
 Note about code
proc gplot data=reflib.stocks;
   plot high*year low*year / overlay legend=legend1
                             vref=1000 to 5000 by 1000 lvref=2
                             haxis=axis1 hminor=4
                             vaxis=axis2 vminor=1;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

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