SAS/GRAPH "SG" Procedures--Not Just for Statisticians!

1

If you are a SAS/GRAPH user, you may have heard about the new Statistical Graphics ("SG") procedures that are new in SAS 9.2. These procedures are designed to make it easier to produce common statistical charts and plots.

You may have assumed that the procedures are only for folks who can explain the difference between a fitted LOESS curve and a penalized B-spline curve (which I can't). In fact, several of the new procedures (SGPLOT, SGPANEL, and SGSCATTER) can be used to produce non-statistical graphs, such as bar charts and line plots. In some cases, they can be used to produce non-statistical charts and plots that can't be created with PROC GCHART or PROC GPLOT. For example, the following program produces a bar chart with transparent, overlayed bars:

proc sgplot data=budget;
    vbar year /
response=expenses
    nostatlabel
transparency=.5;
    vbar year /
response=sales
    barwidth=.6 nostatlabel
    transparency=.5;
title "Sales and Expenses";
run;

PROC SGPANEL provides an easy way to place multiple graphs on a page, where each graph corresponds to a value of a classification variable (or values of multiple variables). The following program uses PROC SGPANEL to produce the same graph as above, but for multiple offices.

proc sgpanel data=budget;
    panelby office /
novarname;
    vbar year /
response=expenses
    nostatlabel
transparency=.5;
    vbar year /
response=sales
    barwidth=.6 nostatlabel
    transparency=.5;
title "Sales and Expenses";
run;

Obviously, there is a lot more to the SG procedures than I've shown you here. You can find a good introduction in this PROC SGPLOT paper. Check out the full documentation here.  You can also learn more in our Statistical Graphics with ODS training course.

Share

About Author

Mike Kalt

Technical Training Specialist

Mike Kalt is an instructor and course developer at SAS Institute. His most recent course development project is "Producing Maps with SAS/GRAPH", which he highly recommends.

Related Posts

1 Comment

  1. Pingback: SAS Training’s Greatest Hits - The SAS Training Post

Leave A Reply

Back to Top