340 likes | 693 Views
Using PROC SGPLOT for Quick High Quality Graphs. Lora Delwiche Susan Slaughter. ODS Graphics. New with SAS 9.2 Phase 1 Need SAS/GRAPH Statistical procedures now produce graphics New procedures just for graphing SGPLOT SGSCATTER SGPANEL SGRENDER. SGPLOT. 15 types of graphs
E N D
Using PROC SGPLOT for Quick High Quality Graphs Lora Delwiche Susan Slaughter
ODS Graphics • New with SAS 9.2 Phase 1 • Need SAS/GRAPH • Statistical procedures now produce graphics • New procedures just for graphing • SGPLOT • SGSCATTER • SGPANEL • SGRENDER
SGPLOT • 15 types of graphs • Simple statements • Can combine graphs • Results in standard image file formats • View graphs in standard viewers • Use ODS styles and destinations
Does everyone have the handout? • Step-by-step instructions • Tables of selected SGPLOT statements • The workshop materials can be found at http://support.sas.com/events/sasglobalforum/2009/handson
Controlling plot structure • Most plot types • Can add grouping variable • Some plot types have additional options • HISTOGRAM and DENSITY • Scale for axis (percent, count, or proportion) • VBAR and HBAR • Numeric response variable
Controlling graph appearance • LABEL statement • User-defined formats • General SGPLOT options • Legend labels • Transparency settings • Displaying markers (or not)
Controlling graph appearance • Options specific to plot type • REG • Display confidence limits • SCATTER • Label data points • NEEDLE • Baseline value
Optional Statements • Reference lines • X or Y axis • Can add labels • Axis attributes • Labels • Type (Discrete, Linear, Log or Time) • Values for tics • Grid • Insets
Attributes • Markers • Symbol • Color • Size • Lines • Pattern • Color • Thickness • Fill • Color
ODS Destinations • Uses standard ODS destinations • LISTING • HTML • PDF • RTF
ODS Styles • For LISTING destination styles apply to graphs only • Can use any style for example: • ANALYSIS Color • STATISTICAL Color • JOURNAL Gray Scale • JOURNAL2 Black and White
ODS Graphics Editor • Make changes to existing graphs • LISTING destination must be open • SGEDIT ON • SGEDIT OFF • Additional methods in SAS 9.2 Phase 2
SGPANEL • Most statements same as SGPLOT • Just add PANELBY statement • Produces separate plot for each value of PANELBY variable
Recommended paper Secrets of the SG Procedures by Dan Heath, SGF 2009 Find any SAS conference paper at www.lexjansen.com
Any Questions? The Little SAS Book: A Primer Fourth Edition