SAS/Graphics

From Wikibooks, open books for an open world
< SAS
Jump to navigation Jump to search


Gplot[edit | edit source]

symbol color=blue value=square interpol=none;
proc gplot data=work.australia ; 
plot lifesat*lngdp /grid; 
run ;
  • The symbol statement defines the color, the value and the interpolation between the points on the plot.
    • interpol can be "none" (scatterplot), "needle", "regression" (regression line), "line", "spline".
  • You can put two plots on the same graph with the 'overlay' option in the plot statement
symbol1 color=blue value=square interpol=none;
symbol2 color=red value=dot interpol=line;
proc gplot data = australia2 ; 
plot  lifesat*lngdp = 1 lifesat_pred*lngdp = 2 /overlay grid; 
run ;

Export to other format[edit | edit source]

You can export to png, jpeg, pdf … Here is an example with a png file.

goptions reset=all;
filename output "W:/…/regression.png"; 
goptions device=png gsfname=output gsfmode=replace;
symbol1 color=blue value=square interpol=none;
symbol2 color=red value=circle interpol=line;
title "Regression Line" ; 
proc gplot data = australia2 ; 
plot  lifesat*lngdp = 1 lifesat_pred*lngdp = 2 /overlay grid; 
run ;