%let gpath='.';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Compute frequencies--*/
proc means data=sashelp.cars(where=(type ne 'Hybrid'));
class origin type;
var mpg_city;
output out=cars(where=(_type_ > 2))
N=N;
run;
proc print;run;
/*--Bubble plot color response--*/
ods graphics / reset width=5in height=3in imagename='Color_Response';
title 'Vehicle Frequencies by Origin and Type';
proc sgplot data=cars;
label N='Frequency';
scatter x=origin y=type / group=origin groupdisplay=cluster transparency=1;
bubble x=origin y=type size=N / colorresponse=n;
xaxis display=(nolabel) grid;
yaxis display=(nolabel) grid;
run;
/*--Bubble plot skin--*/
ods graphics / reset width=5in height=3in imagename='Color_Response_Skin';
title 'Vehicle Frequencies by Origin and Type';
proc sgplot data=cars;
label N='Frequency';
scatter x=origin y=type / group=origin groupdisplay=cluster transparency=1;
bubble x=origin y=type size=N / colorresponse=n dataskin=sheen datalabel=n
datalabelpos=center datalabelattrs=(color=black size=8);
xaxis display=(nolabel) grid;
yaxis display=(nolabel) grid;
run;
/*--Box Whisker Percentile--*/
ods graphics / reset width=5in height=3in imagename='Box_Whisker';
title 'Mileage by Type (1st and 99th Percentile)';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid'));
vbox mpg_city / category=type whiskerpct=1;
xaxis display=(nolabel);
yaxis display=(nolabel) grid;
run;
/*--VBarParm Stacked--*/
ods graphics / reset width=5in height=3in imagename='VBarParm_Stacked';
title 'Frequencies by Origin and Type';
proc sgplot data=cars;
vbarparm category=type response=n / group=origin dataskin=pressed
groupdisplay=stack seglabel seglabelfitpolicy=none;
xaxis display=(nolabel);
yaxis grid;
run;
/*--VBar Fill Type--*/
ods graphics / reset width=4in height=3in imagename='HBar_Gradient';
title 'Mileage by Origin and type';
proc sgplot data=sashelp.cars(where=(type ne 'Hybrid'));
hbar origin / response=mpg_city group=type stat=mean groupdisplay=cluster dataskin=pressed
filltype=gradient;
yaxis display=(nolabel) reverse;
xaxis grid;
run;
data heart;
keep Type Sex BP;
length Type $10;
set sashelp.heart;
Type='Systolic'; BP=systolic; output;
Type='Diastolic'; BP=diastolic; output;
run;
/*proc print;run;*/
/*--Grouped Histogram--*/
ods graphics / reset attrpriority=color width=5in height=3in imagename='Grouped_Histogram';
title 'Blood Pressure by Type';
proc sgplot data=heart;
histogram bp / group=type filltype=gradient transparency=0.5 nbins=50 name='h';
density bp / group=type;
xaxis display=(nolabel) max=250;
yaxis grid;
keylegend 'h' / location=inside across=1 position=topright;
run;