Previous Page | Next Page

The SGPLOT Procedure

Example 5: Creating Lines and Bands from Pre-Computed Data


Procedure features:

BAND statement

KEYLEGEND statement

SCATTER statement

SERIES statement

Sample library member: GSGPLBND

[GSGPLBND - Highlighting a Region of Values by Using a Band]

This example shows how to use pre-computed data to create a scatter plot, fit line, and confidence bands. The data set was created by the REG procedure. This technique is useful for more complex fit models.

 Note about code
proc sgplot data=sashelp.classfit;
  title "Fit and Confidence Band from Precomputed Data";
  band x=height lower=lower upper=upper /
       legendlabel="95% CLI" name="band1";
  
 Note about code
  band x=height lower=lowermean upper=uppermean /
       fillattrs=GraphConfidence2
       legendlabel="95% CLM" name="band2";
  scatter x=height y=weight;
  series x=height y=predict / lineattrs=GraphPrediction
         legendlabel="Predicted Fit" name="series";
 Note about code
 Note about code
  keylegend "series" "band1" "band2" / location=inside position=bottomright;
run;

Previous Page | Next Page | Top of Page