ods html close; %let gpath=C:\; %let w=4in; %let h=2.5in; %let dpi=200; ods listing gpath="&gpath" image_dpi=&dpi; /*--Generate some data--*/ data bars; drop i j a; length Name $40; a=0.99; do i=1 to 10; Actual=a*ranuni(1); Predict=Actual*(1+ranuni(1))/2; a=a**1.4; if a < 0.1 then a=0.1; /*--Create random length strings with some blanks--*/ len=20*(1+ranuni(1)); do j=1 to len; if j=1 or ranuni(1) > 0.2 then substr(Name,j)=byte(int(97+26*ranuni(2))); else substr(Name,j)=' '; end; name=propcase(name); output; end; run; proc print;run; /*--VBAR with long categories--*/ ods graphics / reset width=&w height=&h imagename='VBar_Default'; title 'Actual Values by Name'; proc sgplot data=bars noborder noautolegend; vbar name / response=actual nostatlabel dataskin=pressed fillattrs=graphdata2; xaxis display=(nolabel); yaxis offsetmin=0 display=(nolabel noline noticks) grid; run; /*--HBAR Default labels--*/ ods graphics / reset width=&w height=&h imagename='HBar_Default'; title 'Actual Values by Name'; proc sgplot data=bars noborder noautolegend; hbar name / response=actual nostatlabel dataskin=pressed fillattrs=graphdata4; yaxis display=(nolabel); xaxis offsetmin=0 display=(nolabel noline noticks) grid; run; /*--HBAR split labels--*/ ods graphics / reset width=&w height=&h imagename='HBar_Split'; title 'Actual Values by Name'; proc sgplot data=bars noborder noautolegend; hbar name / response=actual nostatlabel dataskin=pressed fillattrs=graphdata5; yaxis display=(nolabel) fitpolicy=split valueattrs=(size=6 weight=bold); xaxis offsetmin=0 display=(nolabel noline noticks) grid; run; /*--HBAR with data labels--*/ ods graphics / reset width=&w height=&h imagename='HBar_Labels'; title 'Actual Values by Name'; proc sgplot data=bars noborder noautolegend; hbar name / response=actual nostatlabel dataskin=pressed fillattrs=graphdata6 datalabel=name datalabelattrs=(weight=bold); yaxis display=(novalues nolabel noticks); xaxis offsetmin=0 display=(nolabel noline noticks) grid; run;