%let gpath='C:\'; %let dpi=200; proc means data=sashelp.cars; class origin type; var mpg_city horsepower msrp; output out=carmeans(where=(_type_ = 3)) mean(mpg_city horsepower msrp) = MPG HorsePower MSRP; run; data carmeans; format mpg 4.1 horsepower 3.0 msrp dollar7.0; set carmeans(where=(type not in ('Hybrid' 'Truck')) keep=Origin type mpg horsepower msrp); lb_mpg='MPG'; lb_hp='HP'; lb_msrp='MSRP'; lb_y=1; run; proc print;run; ods html close; ods listing gpath=&gpath image_dpi=&dpi; /*--VBar with Axis Table--*/ ods graphics / reset width=5in height=3in imagename='BarTable'; proc sgplot data=sashelp.cars(where=(type not in ('Hybrid' 'Truck'))); title 'Mileage by Origin'; format mpg_city 4.1; vbar origin / response=mpg_city dataskin=gloss stat=mean; xaxistable mpg_city / label labelpos=left stat=mean location=inside; xaxis display=(nolabel); run; /*--Grouped VBarParm with Axis Table--*/ ods graphics / reset width=5in height=3in imagename='BarTableGroup'; proc sgplot data=carmeans; title 'Mileage by Origin and Type'; vbarparm category=origin response=mpg / group=type dataskin=gloss; xaxistable mpg / class=type label labelpos=left location=inside; xaxis display=(nolabel); keylegend / location=inside position=topright; yaxis offsetmax=0.1; run; /*--VBar with Scatter table for one stat--*/ ods graphics / reset width=5in height=3in imagename='BarTableScatterMpg'; proc sgplot data=carmeans; title 'Mileage by Origin and Type'; vbarparm category=origin response=mpg / dataskin=gloss group=type; scatter x=origin y=lb_mpg / markerchar=mpg group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; xaxis display=(nolabel); yaxis grid offsetmin=0.1; y2axis offsetmax=0.95 display=(nolabel) valueattrs=(size=6); run; /*--VBar with Scatter table with row headers on right--*/ ods graphics / reset width=5in height=3in imagename='BarTableScatterAll'; proc sgplot data=carmeans; title 'Mileage by Origin and Type'; vbarparm category=origin response=mpg / dataskin=gloss group=type; scatter x=origin y=lb_mpg / markerchar=mpg group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; scatter x=origin y=lb_hp / markerchar=horsepower group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; scatter x=origin y=lb_msrp / markerchar=msrp group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; xaxis display=(nolabel); yaxis grid offsetmin=0.15; y2axis offsetmax=0.88 display=(nolabel) valueattrs=(size=6); run; /*--VBar with Scatter table with row headers on left--*/ ods graphics / reset width=5in height=3in imagename='BarTableScatterRef'; proc sgplot data=carmeans; title 'Mileage by Origin and Type'; vbarparm category=origin response=mpg / dataskin=gloss group=type; scatter x=origin y=lb_mpg / markerchar=mpg group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; scatter x=origin y=lb_hp / markerchar=horsepower group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; scatter x=origin y=lb_msrp / markerchar=msrp group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; refline 'MPG' 'HP' 'MSRP' / axis=y2 lineattrs=(thickness=0) label labelpos=min labelattrs=(size=6); xaxis display=(nolabel); yaxis grid offsetmin=0.15; y2axis offsetmax=0.9 display=none valueattrs=(size=6); run; /*--Bar with Table without legend--*/ ods graphics / reset width=5in height=3in imagename='BarTableNoLegend'; proc sgplot data=carmeans noautolegend; title 'Mileage by Origin and Type'; vbarparm category=origin response=mpg / dataskin=gloss group=type; scatter x=origin y=lb_y / markerchar=type group=type groupdisplay=cluster markercharattrs=(size=6 color=black); scatter x=origin y=lb_mpg / markerchar=mpg group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; scatter x=origin y=lb_hp / markerchar=horsepower group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; scatter x=origin y=lb_msrp / markerchar=msrp group=type groupdisplay=cluster markercharattrs=(size=6 weight=bold) y2axis; refline 'MPG' 'HP' 'MSRP' / axis=y2 lineattrs=(thickness=0) label labelpos=min labelattrs=(size=6); xaxis display=(nolabel noticks); yaxis grid offsetmin=0.15; y2axis offsetmax=0.9 display=none valueattrs=(size=6); run;