Chapter 8 ODS Graphics ODS graphics were not

  • Slides: 12
Download presentation
Chapter 8: ODS Graphics ODS graphics were not available prior to SAS 9. 2

Chapter 8: ODS Graphics ODS graphics were not available prior to SAS 9. 2 § They have been implemented across a wide range of procedures § ODS Graphics is turned on by default § © Fall 2011 John Grego and the University of South Carolina 1

Saving graphs § § Graphs can be routed to different devices (default is HTML

Saving graphs § § Graphs can be routed to different devices (default is HTML in SAS Studio) For default output, graphs are available in the Results window as separate objects The default graph type is. png; it can be modified to. jpg, etc Some style choices are readily edited © Fall 2011 John Grego and the University of South Carolina 2

Customizing saved graphs ODS LISTING with the GPATH option can save graphs as single

Customizing saved graphs ODS LISTING with the GPATH option can save graphs as single documents in a variety of formats. § ODS GRAPHICS uses IMAGENAME to personalize graph names § § Format, size and resolution can also be specified. © Fall 2011 John Grego and the University of South Carolina 3

PROC SGPLOT Omnibus procedure to create ODS graphics § We will review § −

PROC SGPLOT Omnibus procedure to create ODS graphics § We will review § − Bar charts − Histograms and box plots − Scatterplots − Time series plots − Fitted curves 4

PROC SGPLOT-Bar Charts Creates vertical or horizontal bar charts § Groups can be added

PROC SGPLOT-Bar Charts Creates vertical or horizontal bar charts § Groups can be added § Bars can actually be summary statistics for continuous variables § PROC SGPLOT; VBAR varname/ GROUP=catname; VBAR varname/ RESPONSE=varname STAT=stattype; LABEL varname=‘varlabel; 5

PROC SGPLOT-Histograms SCALE subcommand graphs percents, counts, or proportions on the vertical axis §

PROC SGPLOT-Histograms SCALE subcommand graphs percents, counts, or proportions on the vertical axis § DENSITY overlays a normal curve (default) or kernel density estimate § PROC SGPLOT; HISTOGRAM varname; DENSITY varname/TYPE=kernel ; 6

PROC SGPLOT-Boxplots VBOX specifies graphing variables § CATEGORY generates side-by-side plots § GROUP specifies

PROC SGPLOT-Boxplots VBOX specifies graphing variables § CATEGORY generates side-by-side plots § GROUP specifies a second categorical variable § PROC SGPLOT; VBOX varname/ CATEGORY=catvarname GROUP=groupvarname; 7

PROC SGPLOT-Scatter Plots § § Alternative to PROC GPLOT Multiple SCATTER statements produce overlaid

PROC SGPLOT-Scatter Plots § § Alternative to PROC GPLOT Multiple SCATTER statements produce overlaid plots LABEL improves the legend for overlaid plots GROUP creates different plotting symbols PROC SGPLOT; SCATTER X=hname Y=vname; GROUP=groupname; XAXIS LABEL=‘xlabel’ VALUES=(low TO high BY increment); 8

PROC SGPLOT-Time Series Plots Data points are connected by lines by default § The

PROC SGPLOT-Time Series Plots Data points are connected by lines by default § The horizontal axis will be time, date, etc § LABEL command for dates follows naming conventions we have seen before § PROC SGPLOT; SERIES X=timeindex Y=vname; GROUP=groupname; XAXIS LABEL=‘xlabel’ VALUES=(‘ddmmmyy’d TO ‘ddmmmyy’d BY increment); 9

PROC SGPLOT-Fitted Curves A scatterplot is automatically generated for REG, LOESS, or PBSPLINE §

PROC SGPLOT-Fitted Curves A scatterplot is automatically generated for REG, LOESS, or PBSPLINE § CLM adds confidence bounds § NOMARKER suppresses the oft-redundant printing of the scatter plot § PROC SGPLOT; REG X=hname Y=vname; LOESS X=hname Y=vname; PBSPLINE X=hname Y=vname; 10

Controlling SGPLOT features In addition to some of the features already discussed, we can

Controlling SGPLOT features In addition to some of the features already discussed, we can add reference lines (REFLINE), change the position of legends (KEYLEGEND), and add embedded text (INSET). § We can also customize graph feature attributes (MARKERATTRS, LINEATTRS, LABELATTRS, FILLATTRS, etc) § 11

PROC SGPANEL § Panel graphs are an increasingly preferred alternative to traditional methods for

PROC SGPANEL § Panel graphs are an increasingly preferred alternative to traditional methods for multi-graph displays. PROC SGPANEL ; PANELBY variablelist; SCATTER X=hname Y=vname; SERIES X=index Y=vname; Etc. 12