%let gpath=''; %let dpi=200; ods html close; ods listing style=htmlblue gpath=&gpath image_dpi=&dpi; /*--Box plot with connect--*/ ods graphics / reset ANTIALIASMAX=5300 width=5in height=3in imagename='Box_Connect'; title 'Cholesterol by Cause of Death'; proc sgplot data=sashelp.heart noautolegend noborder; vbox cholesterol / category=deathcause connect=mean; xaxis display=(nolabel); run; /*--Box plot with connect--*/ ods graphics / reset ANTIALIASMAX=5300 width=5in height=3in imagename='Box_Group_Connect'; title 'Cholesterol by Cause of Death'; proc sgplot data=sashelp.heart noautolegend noborder; vbox cholesterol / category=deathcause connect=mean group=sex; xaxis display=(nolabel); run; /*--Box plot with group colors--*/ ods graphics / reset ANTIALIASMAX=5300 width=5in height=3in imagename='Box_Group'; title 'Cholesterol by Cause of Death'; proc sgplot data=sashelp.heart noautolegend noborder; vbox cholesterol / category=deathcause group=deathcause; xaxis display=(nolabel); run; /*--Compute the Mean and Median by sex--*/ proc means data=sashelp.heart; class deathcause; var cholesterol; output out=heart(where=(_type_ > 0) keep=deathcause mean median _type_) mean = mean median = median; run; proc print;run; /*--Merge the data--*/ data heart2; keep deathcause mean median cholesterol; set sashelp.heart heart; run; proc print data=heart2;run; /*--Box plot with connect and group colors--*/ ods graphics / reset ANTIALIASMAX=5300 width=5in height=3in imagename='Box_Group_Multi_Connect'; title 'Cholesterol by Cause of Death'; proc sgplot data=heart2 noautolegend noborder; vbox cholesterol / category=deathcause group=deathcause; series x=deathcause y=mean / name='mean' legendlabel='Mean'; series x=deathcause y=median / lineattrs=(pattern=dash) name='median' legendlabel='Median'; keylegend "mean" "median" / linelength=32 location=inside across=1 position=topright; xaxis display=(nolabel); run;