Chapter Contents

Previous

Next
The PLOT Procedure

Example 8: Plotting BY Groups


Procedure features:
PLOT statement option
HREF=
Other features:
BY statement

This example shows BY group processing in PROC PLOT.


Program

options nodate pageno=1 linesize=80 pagesize=35;
 Note about code
data education;
   input State $14. +1 Code $ DropoutRate Expenditures MathScore
         Region $;
   label dropout='Dropout Percentage - 1989'
          expend='Expenditure Per Pupil - 1989'
            math='8th Grade Math Exam - 1990';
   datalines;
Alabama        AL 22.3 3197 252 SE
Alaska         AK 35.8 7716 .   W
...more data lines...
New York       NY 35.0 .    261 NE
North Carolina NC 31.2 3874 250 SE
North Dakota   ND 12.1 3952 281 MW
Ohio           OH 24.4 4649 264 MW
;
 Note about code
proc sort data=education;
   by region;
run;
 Note about code
proc plot data=education;
   by region;
 Note about code
    plot expenditures*dropoutrate='*' / href=28.6;
    title 'Plot of Dropout Rate and Expenditure Per Pupil';
 run;


Output
PROC PLOT produces a plot for each BY group. Only the plots for Midwest and Northeast are shown. [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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