%let gpath='';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Generate data--*/
data data;
keep Day Frequency Response;
pi=constant("PI");
do Day = 0 to 10;
val=sin(18*day*pi/180);
Response = ifn(val > 1e-10, val, 0);
Frequency = int(150*response);
output;
end;
run;
ods html;
title 'Frequency and Response by Day';
proc print data=data noobs;
var day frequency response;
run;
ods html close;
/*--Traditional Bar Chart only--*/
ods graphics / reset width=4in height=3in imagename='graph';
proc sgplot data=data nowall noborder;
vbar day / response=Frequency filltype=gradient fillattrs=graphdata1
nostatlabel baselineattrs=(thickness=0) datalabel;
xaxis display=(nolabel);
yaxis display=(nolabel) grid;
run;
/*--Graph Table--*/
ods graphics / reset width=4in height=3in noscale imagename='graphTable';
proc sgplot data=data nowall noborder;
hbar day / response=Frequency filltype=gradient fillattrs=graphdata2
nostatlabel baselineattrs=(thickness=0);
yaxistable Day Frequency Response / location=inside position=left nostatlabel;
yaxis display=none;
xaxis display=none grid offsetmin=0.05;
run;
/*--Generate longer data set--*/
%let Days=20;
data data2;
keep Day Frequency Response;
pi=constant("PI");
do Day = 0 to &days;
val=sin(9*day*pi/180);
Response = ifn(val > 1e-10, val, 0);
Frequency = int(150*response);
output;
end;
ht=2.0*&days/10+0.5;
call symput("Ht", strip(put (ht,2.0) || 'in'));
run;
%put "&ht";
/*--Scalable Graph Table--*/
ods graphics / reset width=4in height=&ht noscale imagename='graphTableBig';
proc sgplot data=data2 nowall noborder;
hbar day / response=Frequency filltype=gradient fillattrs=graphdata3
nostatlabel baselineattrs=(thickness=0);
yaxistable Day Frequency Response / location=inside position=left nostatlabel;
yaxis display=none;
xaxis display=none grid offsetmin=0.05;
run;
title;