%let gpath='.';
ods html close;
/*--Bar Data--*/
data Bar;
do Cat=2011 to 2014;
Resp=int(16*ranuni(3));
output;
end;
run;
/*--Bar Chart--*/
%let dpi=200;
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset width=5in height=2.5in imagename='Bar Chart';
title 'Revenues (Millions) by Year';
proc sgplot data=Bar noborder noautolegend;
vbar cat / response=resp fillattrs=graphdata1 dataskin=pressed
datalabel datalabelattrs=(size=12 weight=bold);
xaxis display=(noticks noline nolabel) integer offsetmin=0.15 offsetmax=0.15;
yaxis display=(nolabel noticks noline) min=0 integer grid;
run;
/*--Generate coins data from Bar--*/
data coins;
drop max;
set bar;
Max=Resp;
do Val=1 to Max by 1;
output;
Resp=.;
end;
run;
ods html;
proc print data=bar;run;
proc print data=coins;run;
ods html close;
/*--Coin Marker--*/
%let Coin=C:\Work\Blogs\Graphically Speaking\2016\Post_23_June_12_Coins\India_2_Annas_Trans.png;
/*--Coin Stack--*/
%let dpi=300;
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset width=5in height=2.5in imagename='Coins_India';
title 'Revenues (Millions) by Year';
proc sgplot data=coins noborder noautolegend;
symbolimage name=Coin image="&Coin";
scatter x=cat y=val / markerattrs=(symbol=Coin size=110) jitter jitterwidth=0.03;
text x=cat y=resp text=resp / textattrs=(size=20 weight=bold color=white)
strip position=top backlight=0.75;
xaxis display=(noticks noline nolabel) integer offsetmin=0.15 offsetmax=0.15;
yaxis display=none offsetmin=0.2 offsetmax=0.2;
run;