%let gpath=C:\; %let dpi=200; %let w=4in; %let h=3in; ods html close; ods listing gpath="&gpath" image_dpi=&dpi; /*--Box Plot-*/ ods graphics / reset width=&w height=&h imagename='Box'; title 'Mileage by Type'; proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder; vbox mpg_city / category=type; xaxis display=(noline noticks nolabel); yaxis display=(noline noticks) grid; run; /*--Box Plot with cap scale--*/ ods graphics / reset width=&w height=&h imagename='Box_Cap'; title 'Mileage by Type'; proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder; vbox mpg_city / category=type capscale=0.5; xaxis display=(noline noticks nolabel); yaxis display=(noline noticks) grid; run; /*--Data-*/ proc means data=sashelp.cars(where=(type ne 'Hybrid')) noprint; class type; var mpg_city; output out=carsmean(where=(_type_ > 0)) Mean=Mean uclm=Upper lclm=Lower; run; /*--Scatter Plot-*/ ods graphics / reset width=&w height=&h imagename='Scatter'; title 'Mileage by Type'; proc sgplot data=carsmean noborder; scatter x=type y=mean / yerrorupper=upper yerrorlower=lower markerattrs=(symbol=circlefilled size=3); xaxis display=(noline noticks nolabel); yaxis display=(noline noticks) grid min=0; run; /*--Scatter Plot with cap scale--*/ ods graphics / reset width=&w height=&h imagename='Scatter_cap'; title 'Mileage by Type'; proc sgplot data=carsmean noborder; scatter x=type y=mean / yerrorupper=upper yerrorlower=lower errorcapscale=0.3 markerattrs=(symbol=circlefilled size=3); xaxis display=(noline noticks nolabel); yaxis display=(noline noticks) grid min=0; run; /*--Bar Chart-*/ ods graphics / reset width=&w height=&h imagename='Bar'; title 'Mileage by Type'; title 'Mileage by Type'; proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder; vbar type / response=mpg_city stat=mean limits=upper fillattrs=graphdata2 filltype=gradient fillendcolor=darkred; xaxis display=(noline noticks nolabel); yaxis display=(noline noticks) grid; run; /*--Bar Chart with cap scale-*/ ods graphics / reset width=&w height=&h imagename='Bar_Cap'; title 'Mileage by Type'; title 'Mileage by Type'; proc sgplot data=sashelp.cars(where=(type ne 'Hybrid')) noborder; vbar type / response=mpg_city stat=mean limits=upper limitcapscale=2 filltype=gradient fillendcolor=darkred fillattrs=graphdata2; xaxis display=(noline noticks nolabel); yaxis display=(noline noticks) grid; run;