This post was kindly contributed by NOTE: The Blog of RTSL.eu - Development With SAS - go there to comment and to read the full post. |
When Phil Holland asked me (and others) to review his upcoming new book Power User’s Guide to SAS Graph Templates, I gladly accepted: Phil is a long-standing friend of mine, I’ve always enjoyed programming with SAS/GRAPH procedures, and I haven’t used the “new” ODS graphics procedures (known prior to V9.3 as the statistical graphics procedures) but I’m keen to learn. Little did I know what an eye-opener the exercise would turn out to be.
That’s no criticism of Phil’s book. It’s most informative, and written in Phil’s usual, facts-first style. The eye-opening element for me was how full-featured the ODS graphics procedures are. To a large degree they provide all of the facilities of the “old” graphics procedures (such as GPLOT and GCHART); and that left me concluding that I must up-skill myself to the new procedures. And it also left me wondering, with so much duplication between the old and the new procedures, what are SAS’s plans for the old procedures. Can we expect any future enhancements to them, or are they functionally-stabilised.
I quickly tried-out PROC SGPLOT as a comparison with PROC GPLOT, with immediate success. I’ll leave you to run the code below and make your own comparisons. However, I think you’ll agree that the default SGPLOT output is more immediately presentable than the output from GPLOT.
proc sgplot data=sashelp.snacks;
where product eq: ‘B’ and
date between ‘1feb2004’d and ’29feb2004’d;
series x=date y=qtysold /group=product;
run;
proc gplot data=sashelp.snacks;
where product eq: ‘B’ and
date between ‘1feb2004’d and ’29feb2004’d;
plot qtysold*date=product;
run;quit;
I’ve not managed to find a SAS statement on the future of the old procedures, but the ODS Graphics: Procedures Guide does provide a comparison of features between old and new, which is most informative. In essence it explains that the old procedures are “device-based” and influenced by GOPTIONS, whilst the new procedures are ODS-aware and are influenced by the ODS GRAPHICS statement.
Rob Allison produced a neat web page paper that demonstrates old and new procedures alongside each other, and Phil presented a paper at SAS Global Forum 2011 on Why Should You Be Using the New SG (Statistical Graphics) Procedures in SAS 9.2? which answers its own question very well. I’ll not go into any further detail in this article (I’m still learning myself), so I’ll leave Phil to have the last word (with an extract from his SGF paper):
There is always a hope that a new software feature will improve on what already exists, but fear of the unknown stops you from trying it out, just in case it is a waste of time. My paper tries out the new SG (Statistical Graphics) procedures in SAS 9.2 for you, and demonstrates some of the new and useful features of PROC SGPLOT, PROC SGPANEL, PROC SGSCATTER and PROC SGRENDER.
While PROC GPLOT, and also PROC GCHART, can create acceptable graphs, their default settings are generally not what is required. The SG procedures employ default settings that are much closer to what is likely to be required, and adjustments are therefore easier to code and document.
PROC SGPLOT and PROC SGPANEL allow the production of combined graphs which are, at best, difficult to create using PROC GPLOT or PROC GCHART and Annotate. PROC SGPANEL and PROC SGSCATTER have the ability to create multiple graphs with common axes, which previously required many SAS/GRAPH procedure calls, careful template design, followed by the use of PROC GREPLAY to render the completed graph. For the ultimate control over any graph, ODS Graphics templates, which can include user-selected features, can be rendered using PROC SGRENDER to allow the simple reuse of tested graphics code.
Thanks Phil.
This post was kindly contributed by NOTE: The Blog of RTSL.eu - Development With SAS - go there to comment and to read the full post. |