Presentation is loading. Please wait.

Presentation is loading. Please wait.

ODS Statistical Graphics in SAS 9.2 January 17, 2010.

Similar presentations


Presentation on theme: "ODS Statistical Graphics in SAS 9.2 January 17, 2010."— Presentation transcript:

1 ODS Statistical Graphics in SAS 9.2 January 17, 2010

2 Prior to SAS 9.2 SAS 9.1 introduced experimental extension to ODS Statistical Graphics (ODS Graphics) in over 20 SAS/STAT and SAS/ETS procedures to create statistical graphics automatically  Minimal additional syntax  Graphs included scatter plots, histograms and boxplots

3 New in SAS 9.2 Over 50 procedures in SAS/STAT, SAS/ETS, SAS/QC and Base SAS  Produced by default or specification of procedure options New graph types, ODS styles, point-and-click editor for enhancing titles, labels and other features Modify graphs via underlying templates in Graph Template Language (GTL) LISTING destination supported by ODS Graphics New family of ODS Graphics to create standalone plots (ie. Scatterplots overlaid with smoother) SGRENDER procedure to create customized graphs via GTL

4 SAS Graph Gallery http://support.sas.com/sassamples/graphgallery/index.html

5 Getting Started SAS Global Forum 2008 – SAS Presents (Paper 305-2008) Getting Started with ODS Statistical Graphics in SAS® 9.2— Revised 2009 by Robert N. Rodriguez, SAS Institute Inc., Cary, NC http://support.sas.com/rnd/app/papers/intodsgraph.pdf

6 How can I create a survival plot in SAS? Specify plot in the PROC LIFETEST using traditional graphics Specify plot in the PROC LIFETEST with ODS Graphics enabled Use Graphic Template Language (GTL) Use ODS Graphics Designer

7 Survival Curve with Traditional Graphics

8 ODS Graphics and Default Graphs Some procedures have graphs associated with them To enable ODS Graphics: ods graphics on; proc lifetest data=example.example plots=survival(test atrisk=0 to 730 by 60); time time2death_2yr*censor_2yr(1); strata partner_excl; title 'Survival curve'; run;

9 Survival Curve with ODS Graphics Enabled (style=default)

10 ODS RTF (style=journal)

11 ODS Graphics Templates Each default graph is controlled by a template written in the Graph Template Language (GTL). GTL specifies graph layouts (lattices, overlays), types (scatter plots, histograms), titles, footnotes, insets, colors, symbols, lines, etc. Templates can be modified to customize graphs

12 Name of the Default Graph Template ods trace on; ods graphics on; proc lifetest data=example.example plots=survival (test atrisk=0 to 730 by 60) outsurv=survest; time time2death_2yr*censor_2yr(1); strata partner_excl; title 'Survival curve'; run; title; ods trace off;

13 Partial LOG file

14 Source Statements for Template proc template; source Stat.Lifetest.Graphics.ProductLimitSurvival; run; Source statements output in the LOG file Source statements

15 Before Modifying the Template… Compiled template is stored in the template item stores Set ODS path to search for templates in the Work item store ods path (prepend) work.templat(update); Any template submitted is stored in Work.Templat is deleted at the end of the SAS session.

16 Modifying a Template Modify a template by editing the statements, adding a PROC TEMPLATE statement, and submitting the template source to SAS Modified template

17 Modified Template

18 Changing the STYLE proc template; source styles.default; run; Source statements for style template Source statements

19 Template Complexity ‘The GTL is a powerful language with many statements and options, and often many different ways to accomplish the same thing. Different procedure writers sometimes found different ways to do the same thing.’…’The template that you see might be very large, complex, and verbose.’…‘When you look at a template, do not expect that you will be able to find some justification for every statement and every option if you only search hard enough. Nor should you expect to find documentation for every option. Some options are deliberately undocumented because they might change in future releases.’ ‘Some templates are complex. Others are very complex. Some are much more complex than they need to be for your particular application. However, you do not have to understand most of that complexity. All you have to do is isolate the parts that you want to change, and change those parts while ignoring the surrounding complexity.’ From ‘Modifying ODS Statistical Graphics Templates in SAS® 9.2’ by Warren F. Kuhfeld

20 Editable Graphs ods listing sge=on; proc lifetest data=example.example plots=survival (test atrisk=0 to 730 by 60); ods select SurvivalPlot; time time2death_2yr*censor_2yr(1); strata partner_excl; title 'Survival Plot'; run;

21 Generates a SGE file

22

23 Modified Template and Edited

24 ODS Graphics Designer to Create Your Own Templates pre-production release of the ODS Graphics Designer in SAS® 9.2 Phase 2 provides a GUI interface for building ODS templates for graphs. A Java application external program using the SAS software environment  the SAS data sets used to create templates must be stored as permanent SAS data sets in accessible libraries.

25

26

27 Survival Plot using SGDESIGN

28 Example using a different data set  Data needs to be set up differently from data used for analysis

29

30

31

32 Would I start using SAS for graphing? It depends…  How much time do I have?  Do I have to change a template or SAS code?

33 How not to collaborate with a biostatistician http://www.xtranormal.com/watch/6878253/


Download ppt "ODS Statistical Graphics in SAS 9.2 January 17, 2010."

Similar presentations


Ads by Google