Transparency = 1.0 is fully transparent.ġ6 Scatterplots proc sgplot data=mylib.employee scatter x=salbegin y=salary / group=gender run ġ7 Scatterplot with Regression Line proc sgplot data=mylib.employee where jobcat=1 scatter x=prevexp y=salary / group=gender reg x=prevexp y=salary / cli clm nomarkers run ġ8 Regression Lines for Subgroups proc sgplot data=mylib.employee where jobcat=1 reg x=prevexp y=salary / group=gender run ġ9 Paneled Scatterplot with Loess Fit proc sgpanel data=mylib.employee panelby jobcat / columns=3 scatter x=jobtime y=salary / group=gender loess x=jobtime y=salary nomarkers run Ģ0 Scatterplot Matrix proc sgscatter data=mylib.employee where jobcat=1 matrix salbegin salary jobtime prevexp / group=gender diagonal=(histogram kernel) run Ģ1 Series Plots proc sgpanel data=autism panelby sicdegp /columns=3 series x=age y=vsae / group=childid markers legendlabel=" " lineattrs=(pattern=1 color=black) Ģ2 Generate Means proc sort data=autism by sicdegp age run proc means data=autism noprint by sicdegp age output out=meandat mean(vsae)=mean_vsae run data autism2 merge autism meandat(drop=_type freq_) by sicdegp age run Ģ3 Mean Plots Overlaid on Raw Data proc sgplot data=autism2 series x=age y=mean_vsae / group=sicdegp scatter x=age y=vsae run Ģ4 Formats Make Graphs More Readable proc format value jobcat 1="Clerical" 2="Custodial" 3="Manager" value $Gender "f"="female" "m"="male" run Ģ5 Formats Make Graphs More Readable2 proc sgpanel data=mylib.employee panelby jobcat / rows=1 columns=3 novarname vbox salary / category= gender format gender $gender.
run ġ3 Paneled Barcharts proc sgpanel data=mylib.employee panelby gender vbar jobcat / response=salary limitstat = stddev limits = upper stat=mean run ġ4 Histograms proc sgplot data=mylib.employee histogram salary density salary density salary / type=kernel keylegend / location=inside position=topright ġ5 Overlaid Histograms proc sgplot data=mylib.employee histogram salbegin histogram salary / transparency =.5 run Note: Transparency = 0 is opaque. Set the current folderĦ Boxplots proc sgplot data=mylib.employee vbox salary run ħ Boxplots for Categories proc sgplot data=mylib.employee vbox salary/ category=gender run Ĩ Paneled Boxplots proc sgpanel data=mylib.employee panelby jobcat / rows=1 columns=3 vbox salary / category= gender run ĩ Barcharts proc sgplot data=mylib.employee vbar jobcat run ġ0 Stacked Barcharts proc sgplot data=mylib.employee vbar jobcat /group=gender run ġ1 Barcharts with Means and Error Bars proc sgplot data=mylib.employee vbar jobcat / response=salary limitstat = stddev limits = upper stat=mean run ġ2 Barcharts of Proportions proc sgplot data=afifi vbar shoktype / response=died stat=mean format shoktype shokfmt. Double-click on graphics file icon to view graph 1.
Graphs will be automatically be saved as.png files in current SAS folder png (portable network graphics) files are Raster graphics Compact format Usable in most windows applicationsĥ Getting Started 2.
1 Great Graphics Using Proc Sgplot, Proc Sgscatter, and ODS Graphics for SAS /Stat Procedures Kathy Welch CSCAR The University of Michigan MSUG Meeting, Tuesday April 27, 2010Ģ What we will Cover Introduction to Statistical Graphics Procedures Proc Sgplot Proc Sgscatter Proc Sgpanel Editing ODS graphics files Examples of ODS graphics with Statistical Procedures Proc ttest Proc Reg Proc GLM Proc Logisticģ Statistical Graphics Using Proc Sgplot, Proc Sgscatter and Proc Sgpanel Statistical graphics plots use ODS (output delivery system) graphics Statistical graphics are easy to produce, look nice, and are more intuitive than traditional SAS/Graph graphics Statistical Graphics can be edited (to some extent) interactivelyĤ Where are my graphs? Graphs created with ODS graphics will be in Results Window, not in Graph Window Double click on the graphics icon to view the file, using local windows graphics viewer.