1 / 19

Introduction to SAS/Graph 9.2

Introduction to SAS/Graph 9.2. Ken Barz Ken.barz@cpcmed.org Colorado Prevention Center 22Oct2009. In the Beginning, there was. Base SAS: Proc plot listing output only Think stick figures on a line printer SAS/Graph 6-9.1.3: proc gplot ODS output as of SAS 8

mindy
Download Presentation

Introduction to SAS/Graph 9.2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to SAS/Graph 9.2 Ken Barz Ken.barz@cpcmed.org Colorado Prevention Center 22Oct2009

  2. In the Beginning, there was • Base SAS: Proc plot • listing output only • Think stick figures on a line printer • SAS/Graph 6-9.1.3: proc gplot • ODS output as of SAS 8 • Color graphics, sometimes crude, extra $$$ • Complex  steep learning curve

  3. The “Typical” SAS Programmer • Knowledge of data and proc steps • Able to use libname, filename, title and footnote statements • Statistical and reporting procedures • Maybe some ODS and macro language

  4. Learning SAS/Graph 6 – 9.1.3 • Open code vs. run groups • Catalogs, grseg files, SAS registry, and hardware devices. • Options, goptions, greplay, symbols, axes, legends, line types, interpolation parameters, fonts, ODS, annotate, and …

  5. The SAS/Graph 9.2 Approach (Do-Overs!) • Template-based graphics as opposed to device-based graphics. (e.g. proc template) • Default output is to an industry standard (e.g. ODS listing destination=PNG file.) • Full integration with ODS • Output catalogs, grsegs, devices, goptions, annotate, global statements… all go away

  6. The SAS/Graph 9.2 Approach (cont: Main Elements) • Proc Template • Statistical Graphics (SG) Procedures • ODS Graphics Statement • ODS Graphics Editor/Designer • Graph Template Language (GTL)

  7. Learning Proc Template via ODS • Learn the majority of ODS • Use ODS Trace to determine SAS output objects • Learn the capabilities and syntax of proc template • Figure out how to combine it all

  8. (Proc) Template-Based Graphics (SAS 9.2 +) • Output is produced from a compiled ODS template of type STATGRAPH (other types include TABLE, COLUMN, FOOTER, HEADER, CROSSTABS, CELLVALUE, STYLE, TAGSET) • Statistical Graphics procedures use templates (sgplot, sgpanel, …) provided by SAS • Custom templates may be created with Proc Template, the Graphics Template Language (GTL) and Proc sgrender.

  9. Minimum Template Code(defaults to sasuser.templat catalog) proctemplate; define statgraphmytemplate; begingraph; layout overlay; endlayout; endgraph; end; run;

  10. Benefits of Template-Based 9.2 Graphics • Graphics are clean, easy to code and produce • Sizing determined by aspect ratio, not hardware device • Tight integration with ODS, Styles and RTF/Unicode syntax • Attributes cycle automatically • Complex output is easily achieved

  11. Statistical Graphics Procedures • SGPlot • SGPanel • SGScatter • SGRender

  12. Statistical Graphics Procedures (cont) Support for: • By group processing • Formats/Titles/Footnotes/Labels • ODS Graphics statement manages settings

  13. ODS Graphics Statement • Controls the runtime environment for producing template-based graphs • Similar to the old goptions statement (with fewer options) • Options for reset, size, image name and format, scale, dpi, antialiasing, … • Enables the creation of default Statistical Procedure graphs

  14. The ODS Graphics Editor/Designer (9.2 Phase 2) • Interactively add, edit or delete titles, footnotes, super/subscripts, labels, lines, symbols, … • Change the style or the size of the graph • Add annotation to the graph • Available within SAS or as a stand-alone downloadable application

  15. Graph Template Language Creating a graph using GTL involves: • Defining the structure of the graph using the GTL syntax in a STATGRAPH template that is specified on the TEMPLATE procedure. • Creating the graph by running the SGRENDER procedure to associate the appropriate data with the template.

  16. Graph Template Language (cont) Graph layout options include: • Overlay • Gridded/Lattice • Datapanel • OverlayEquated • Overlay3D

  17. Graph Template Language (cont) Graph templates allow customization of: • Titles, footnotes, row and column headers, sidebars and text entries. • Linear, time and log axes. • Styles and attributes. • Appearance of grouped and non-grouped data.

  18. Graph Template Language (cont) Graph templates also allow the use of: • Dynamics • Macro variables • Conditional logic, expressions and functions

  19. Conclusion • In version 9.2, SAS/Graph has been completely re-written to a template-based orientation. • Clean and intricate graphs can now be produced via a straight forward coding method. • The old approaches to SAS/Graph still mostly work as well. • Thank you!

More Related