%let gpath='C:\';
%let dpi=200;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
/*--Data with Character X axis--*/
data band;
do X='Entry A', 'Entry B';
do group= 'A', 'B', 'C', 'D';
Y=1.1+0.4*ranuni(2);
output;
end;
end;
run;
/*--Format for numetic x values--*/
proc format;
value band 1='Entry A'
2='Entry B';
run;
/*--Data with Numeric X axis--*/
data bandNum;
format x band.;
do X=1 to 2 by 1;
do group= 'A', 'B', 'C', 'D';
Y=1.1+0.4*ranuni(2);
output;
end;
end;
run;
/*--Plot with reference lines--*/
ods graphics / reset width=4in height=2.5in imagename='RefLines';
proc sgplot data=band;
scatter x=x y=y / group=group markerattrs=(size=9) name='a';
refline 1.05 1.5 / lineattrs=(pattern=shortdash)
label=("Lower=1.05" "Upper=1.5") labelloc=inside;
yaxis values=(0 to 2 by 0.2) display=(nolabel);
xaxis offsetmin=0.2 offsetmax=0.2 display=(nolabel);
keylegend 'a' / title='Patient:' location=inside position=topright;
run;
/*--Band Extend Plot with character x axis--*/
ods graphics / reset width=4in height=2.5in imagename='Band';
proc sgplot data=band;
band x=x upper=1.5 lower=1.05 / transparency=0.5;
scatter x=x y=y / group=group markerattrs=(size=9) name='a';
yaxis values=(0 to 2 by 0.2) display=(nolabel);
xaxis offsetmin=0.2 offsetmax=0.2 display=(nolabel);
keylegend 'a' / title='Patient:' location=inside position=topright;
run;
/*--Band Extend Plot with numeric x axis--*/
ods graphics / reset width=4in height=2.5in imagename='BandNum';
proc sgplot data=bandNum;
band x=x upper=1.5 lower=1.05 / transparency=0.5;
scatter x=x y=y / group=group markerattrs=(size=9) name='a';
yaxis values=(0 to 2 by 0.2) display=(nolabel);
xaxis offsetmin=0.2 offsetmax=0.2 display=(nolabel) values=(1 2);
keylegend 'a' / title='Patient:' location=inside position=topright;
run;
/*--Band Extend Plot with numeric x axis and Refline labels--*/
ods graphics / reset width=4in height=2.5in imagename='BandNumRefLabels';
proc sgplot data=bandNum;
band x=x upper=1.5 lower=1.05 / transparency=0.5;
refline 1.05 1.5 / lineattrs=(pattern=shortdash thickness=0)
label=("Lower=1.05" "Upper=1.5") labelloc=inside;
scatter x=x y=y / group=group markerattrs=(size=9) name='a';
yaxis values=(0 to 2 by 0.2) display=(nolabel);
xaxis offsetmin=0.2 offsetmax=0.3 display=(nolabel) values=(1 2);
keylegend 'a' / title='Patient:' location=inside position=topright;
run;