%let gpath='C:\'; %let dpi=200; ods html close; ods listing gpath=&gpath image_dpi=&dpi; data cars; set sashelp.cars; N=1; run; /*--Use Data label for Freq--*/ ods graphics / reset width=5in height=3in imagename='BarLabel'; title 'Vehicle Statistics by Origin and Type'; proc sgplot data=cars nowall noborder; hbar type / group=origin groupdisplay=cluster dataskin=pressed baselineattrs=(thickness=0) datalabel datalabelpos=right; yaxis display=(nolabel noline noticks); xaxis display=(noline noticks) grid; run; /*--Use YAxisTable for Freq--*/ ods graphics / reset width=5in height=3in imagename='Freq'; title 'Vehicle Statistics by Origin and Type'; proc sgplot data=cars nowall noborder; label n='Count'; hbar type / group=origin groupdisplay=cluster stat=pct dataskin=pressed baselineattrs=(thickness=0); yaxistable n / stat=sum classdisplay=cluster colorgroup=origin nostatlabel; yaxis display=(nolabel noline noticks); xaxis display=(noline noticks) grid; run; /*--Use YAxisTable for Freq with value HAligh--*/ ods graphics / reset width=5in height=3in imagename='FreqCenter'; proc sgplot data=cars nowall noborder; label n='Count'; hbar type / group=origin groupdisplay=cluster stat=pct dataskin=pressed baselineattrs=(thickness=0); yaxistable n / stat=sum classdisplay=cluster colorgroup=origin nostatlabel valuehalign=center valueattrs=(size=6 weight=bold); yaxis display=(nolabel noline noticks); xaxis display=(noline noticks) grid; run; /*--Display multiple stats--*/ ods graphics / reset width=5in height=3in imagename='MPG3'; title 'Vehicle Statistics by Origin and Type'; proc sgplot data=cars nowall noborder; label mpg_city='Mean City Mileage' mpg_highway='Mean Highway Mileage' n='Count'; format mpg_city mpg_highway 4.1; hbar type / group=origin groupdisplay=cluster stat=pct dataskin=pressed baselineattrs=(thickness=0); yaxistable n / stat=sum classdisplay=cluster colorgroup=origin valueattrs=(size=6 weight=bold) nostatlabel; yaxistable mpg_city mpg_highway/ stat=mean classdisplay=cluster colorgroup=origin valueattrs=(size=6 weight=bold); yaxis display=(nolabel noline noticks); xaxis display=(noline noticks) grid; run; /*--Display multiple stats with Value HAlign--*/ ods graphics / reset width=5in height=3in imagename='Bands'; title 'Vehicle Statistics by Origin and Type'; proc sgplot data=cars nowall noborder; label mpg_city='Mean City Mileage' mpg_highway='Mean Highway Mileage' n='Count'; format mpg_city mpg_highway 4.1; hbar type / group=origin groupdisplay=cluster stat=pct dataskin=pressed baselineattrs=(thickness=0); yaxistable n / stat=sum classdisplay=cluster colorgroup=origin location=inside valuehalign=center valueattrs=(size=6 weight=bold) labelattrs=(size=7); yaxistable mpg_city mpg_highway/ stat=mean classdisplay=cluster colorgroup=origin location=inside valueattrs=(size=6 weight=bold) labelattrs=(size=7) valuehalign=center; yaxis display=(nolabel noline noticks) colorbands=odd colorbandsattrs=(transparency=0.7); xaxis display=(noline noticks) grid; run;