%let gpath='.';
%let dpi=200;
ods html close;
ods listing style=analysis gpath=&gpath image_dpi=&dpi;
/*--Box Plot--*/
ods graphics / reset attrpriority=none width=5in height=3in imagename='BoxPlot';
title h=10pt 'Horsepower by Type and Origin';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder;
format mpg_city mpg_highway horsepower 3.0;
styleattrs axisextent=data;
vbox horsepower / category=type group=origin groupdisplay=cluster dataskin=gloss
meanattrs=(size=6) outlierattrs=(size=5) name='a';
xaxis display=(nolabel noticks noline);
keylegend 'a' / location=inside position=topright across=1 title='';
yaxis display=(noticks noline) grid;
run;
/*--Box Plot with Stack table--*/
ods graphics / reset attrpriority=none width=5in height=3in imagename='BoxPlotTable';
title h=10pt 'Horsepower by Type and Origin';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder;
format mpg_city mpg_highway horsepower 3.0;
styleattrs axisextent=data;
vbox horsepower / category=type group=origin groupdisplay=cluster dataskin=gloss
meanattrs=(size=6) outlierattrs=(size=5) name='a';
xaxistable horsepower / stat=mean class=origin colorgroup=origin location=inside;
xaxis display=(nolabel noticks noline);
keylegend 'a' / location=inside position=topright across=1 title='';
yaxis display=(noticks noline) grid;
run;
/*--Box Plot with Cluster table--*/
ods graphics / reset attrpriority=none width=5in height=3in imagename='BoxPlotTableCluster';
title h=10pt 'Horsepower by Type and Origin';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder;
format mpg_city mpg_highway horsepower 3.0;
styleattrs axisextent=data;
vbox horsepower / category=type group=origin groupdisplay=cluster dataskin=gloss
meanattrs=(size=6) outlierattrs=(size=5) name='a';
xaxistable horsepower / class=origin classdisplay=cluster stat=mean
colorgroup=origin nostatlabel location=inside;
xaxis display=(nolabel noticks noline);
keylegend 'a' / location=inside position=topright across=1 title='';
yaxis grid;
run;
/*--Bar Chart with cluster tables--*/
ods graphics / reset attrpriority=none width=5in height=3in imagename='BoxPlotTables';
title h=10pt 'Mean Auto Statistics by Type and Origin';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder;
format mpg_city mpg_highway horsepower 3.0;
styleattrs axisextent=data;
vbox horsepower / category=type group=origin name='a'
groupdisplay=cluster dataskin=gloss
meanattrs=(size=6) outlierattrs=(size=5);
xaxistable horsepower mpg_city mpg_highway / class=origin
classdisplay=cluster stat=mean
colorgroup=origin location=inside nostatlabel;
xaxis display=(nolabel noticks noline);
keylegend 'a' / location=inside position=topright across=1 title='';
yaxis grid;
run;
/*--Box Plot with table and color bands--*/
ods listing style=analysis;
ods graphics / reset attrpriority=none width=5in height=3in imagename='BoxPlotTablesBands';
title h=10pt 'Mean Auto Statistics by Type and Origin';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder;
format mpg_city mpg_highway horsepower 3.0;
styleattrs axisextent=data;
vbox horsepower / category=type name='a' group=origin groupdisplay=cluster dataskin=gloss
meanattrs=(color=black size=5) medianattrs=(color=black )
outlierattrs=(size=6);
xaxistable horsepower mpg_city mpg_highway / class=origin classdisplay=cluster stat=mean
colorgroup=origin location=inside nostatlabel;
xaxis display=(nolabel noticks noline) colorbands=even
colorbandsattrs=graphbackground;
keylegend 'a' / location=inside position=topright across=1 title='';
yaxis grid;
run;