SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Plots
Selecting Observations


In this lesson so far, you've created plots using all the observations in a data set. You can also select observations based on a condition by using a WHERE statement in your PROC GPLOT step.

If you took the lesson on PROC PRINT or PROC TABULATE, you learned to use the WHERE statement to select observations based on certain conditions.

     proc print data=clinic.admit;
        where actlevel in ('HIGH','LOW'); 
     run;
     proc tabulate data=clinic.stress;
        var maxhr rechr resthr;
        table max*(maxhr rechr resthr);
        where maxhr-resthr<=70; 
     run; 
The WHERE statement works the same way with PROC GPLOT. The following plot, for example, displays only observations where the value for both Swim and AerClass exceeds 35. To select these observations, you use this WHERE statement:

     symbol1 interpol=spline value=none color=red;
     symbol2 interpol=spline value=none color=blue;
     proc gplot data=clinic.therapy1999;
        plot swim*month aerclass*month/overlay;
        where swim>35 and aerclass>35;
     run;

Display plot using WHERE statement.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement