%let gpath='C:\';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Import Data--*/
PROC IMPORT
DATAFILE= 'C:\Data.xlsx'
dbms=xlsx out=data(keep=dmp) replace;
run;
/*--Render Histogram of original data on linear axis--*/
ods graphics / reset width=5in height=3in imagename='Histogram';
proc sgplot data=data noautolegend;
histogram dmp;
fringe dmp / height=5px lineattrs=(color=red);
run;
/*--Render Histogram of original data on linear axis with bin width--*/
ods graphics / reset width=5in height=3in imagename='Histogram_BinWidth';
proc sgplot data=data noautolegend;
histogram dmp / binwidth=2;
fringe dmp / height=5px lineattrs=(color=red) transparency=0.8;
run;
/*--Render Histogram of original data on log axis with Bin Width=0.5--*/
/*--BS=BW/2+Min Value--*/
ods graphics / reset width=5in height=3in imagename='Histogram_Log';
footnote j=l 'BinWidth=0.5 BinStart=0.3';
proc sgplot data=data noautolegend nowall noborder;
histogram dmp / binwidth=0.5 binstart=0.3 scale=count fillattrs=graphdata1;
fringe dmp / height=5px lineattrs=(color=red) transparency=0.8;
xaxis type=log values=(0.05 0.1 0.5 1 5 10 50 100);
run;
/*--Render Histogram of original data on log axis with Bin Width=5--*/
/*--BS=BW/2+Min Value--*/
ods graphics / reset width=5in height=3in imagename='Histogram_Log_5';
footnote j=l 'BinWidth=5 BinStart=2.55';
proc sgplot data=data noautolegend nowall noborder;
histogram dmp / binwidth=5 binstart=2.55 scale=count fillattrs=graphdata1;
fringe dmp / height=5px lineattrs=(color=red) transparency=0.8;
xaxis type=log values=(0.05 0.1 0.5 1 5 10 50 100);
run;
footnote;
/*--Render Histogram of original data on log axis with Bin Width=10--*/
/*--BS=BW/2+Min Value--*/
ods graphics / reset width=5in height=3in imagename='Histogram_Log_10';
footnote j=l 'BinWidth=10 BinStart=5.05';
proc sgplot data=data noautolegend nowall noborder;
histogram dmp / binwidth=10 binstart=5.05 scale=count fillattrs=graphdata1;
fringe dmp / height=5px lineattrs=(color=red) transparency=0.8;
xaxis type=log values=(0.05 0.1 0.5 1 5 10 50 100);
run;
footnote;
/*--Compute log of column--*/
data data;
set data;
logDmp=log10(dmp);
run;
/*--Render Histogram of the Log of the data--*/
ods graphics / reset width=5in height=3in imagename='Histogram_LogData';
proc sgplot data=data noautolegend nowall noborder;
histogram logDmp / binwidth=0.15 fillattrs=graphdata3 scale=count;
fringe logDmp / height=5px lineattrs=(color=red) transparency=0.8;
run;
/*--Render Histogram of the Log of the data--*/
ods graphics / reset width=5in height=3in imagename='Histogram_LogData_Values';
proc sgplot data=data noautolegend nowall noborder;
histogram logDmp / binwidth=0.15 scale=count fillattrs=graphdata3 filltype=gradient dataskin=pressed;
fringe logDmp / height=5px lineattrs=(color=red) transparency=0.8;
yaxis grid;
xaxis values=(-2 -1 0 1 2 3) valuesdisplay=("0.01" "0.1" "1" "10" "100" "1000") label='DMP';
run;