University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home

SAS Helpful Hints

Proc Gplot(Scatter Plots)

Here are two ways of creating scatter plots. I have included many of my favorite graphic options to improve the appearance of the graph. Feel free to modify the options to suite your own personal taste.

Title1 Font=Centx Height=2 'Scatter Plot';

Goptions Device=Win Colors=(Black White Blue Red Gold Green Cyan)
Display Fby=Centx Hby=2 Cback=White;

Axis1 Width=2 Major=(Width=2) Minor=(Width=2) Value=(Font=Duplex Height=2)
    Label=(Angle=90 Rotate=0 Font=Centx Height=2 'Weight');

Axis2 Width=2 Major=(Width=2) Minor=(Width=2) Value=(Font=Duplex Height=2)
    Label=(Font=Centx Height=2 'Age');

*Common symbols: Plus X Star Square Diamond Traingle Dot Circle # $ - +;
Symbol1 Value=Star Interpol=None Width=2 Color=Blue;
Symbol2 Value=None Interpol=R1CLM Line=1 Width=2 Color=Green;
Symbol3 Value=None Interpol=R1 Line=1 Width=2 Color=Red;

Proc Gplot Data=work.A Gout=work.plot;
    Plot weight*age=1 weight*age=2 weight*age=3 / Overlay Frame Vaxis=axis1 Haxis=axis2 Nolegend;
Run;

Legend1 Label=(Font=Centx Height=2 'Color') Value=(Font=Centx Height=2)
    Across=3 Down=2 Position=(Outside|Inside Top|Middle|Bottom Left|Center|Right);
Symbol1 Value=# Interpol=None Width=2 Color=Blue;
Symbol2 Value=$ Interpol=None Width=2 Color=Green;
Symbol3 Value=None Interpol=R1CLM L=1 Width=2 Color=Black;
Symbol4 Value=+ Interpol=None Width=2 Color=Red;
Symbol5 Value=Triangle Interpol=None Width=2 Color=Gold;
Proc Gplot Data=work.B Gout=work.plot;
    Plot weight*age=color / Frame Vaxis=axis1 Haxis=axis2 Legend=Legend1;
Run;


Please send your comments and suggestions about this web page to A. Watts (watts@bst.rochester.edu)