University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home

SAS Helpful Hints

Proc Gchart(Bar Charts)

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

Goptions Device=Win Colors=(Blue Green Red Yellow Cyan Pink Violet Purple Black White)
    Display Fby=Centx Hby=2 Cback=Pink Ftext=Centx Htext=1.5 Ctext=Black;
Title1 Font=Centx Height=2 Color=Black 'Barchart';
Axis1 Color=Black Width=2 Major=(Width=2) Minor=(Width=2) Label=('Mean');
Axis2 Color=Black Width=2;

*Patternid may = By, Group, Midpoint or Subgroup;
*Shape may = Block, Cylinder, Hexagon, Prism or Star;

Proc Gchart Data=work.A;
    Vbar3d color / Type=Mean Sumvar=weight Group=week Errorbar=both
        Outside=Mean
        Raxis=axis1 Maxis=axis2
        Coutline=Black Cframe=Cyan Patternid=Midpoint
        Shape=Block Space=1 Gspace=4;
Run;

Goptions Device=Win Colors=(Blue Green Red Yellow Cyan Pink Violet Purple Black White)
    Display Fby=Centx Hby=2 Cback=Pink Ftext=Centx Htext=1.5 Ctext=Black;
Title1 Font=Centx Height=2 Color=Black 'Barchart';
Axis1 Color=Black Width=2 Major=(Width=2) Minor=(Width=2) Label=('Frequency');
Axis2 Color=Black Width=2;

Proc Gchart Data=work.A;
    Vbar3d week / Type=Freq Midpoints=(0 2 4) Group=wgt Subgroup=color
        Inside=Freq Outside=Freq
        Raxis=axis1 Maxis=axis2
        Coutline=Black Cframe=Cyan
        Shape=Block Width=6 Space=1 Gspace=5;
Run;



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