%let gpath='C:\'; %let dpi=200; /*--Define data for the bands--*/ data bands; input Limits $ xb lower upper; datalines; A 0 -20 20 A 80 -20 20 A 580 -120 120 B 0 -20 20 B 100 -20 20 B 600 -90 90 ; run; proc format; value $name 'A' = 'EN ISO 15197-2003' 'B' = 'ISO 15197-2013'; run; ods html; proc print data=bands;run; ods html close; /*--Make the Graph--*/ ods html close; ods listing gpath=&gpath style=journal image_dpi=&dpi; /*--Draw the Bands with Legend--*/ ods graphics / reset width=5in height=3in imagename='Bland_Altman_1'; proc sgplot data=bands; format Limits $name.; title 'Blood Glucose Results'; band x=xb lower=lower upper=upper / group=Limits outline nofill name='Band'; refline 0; xaxis grid label='YSI Plasma Result (mg/dL)'; yaxis grid values=(-120 to 120 by 20) label='Bias from YSI (mg/dL)'; run; /*--Define data for band labels--*/ data labels; xl=380; yl=100; label='EN ISO 15197-2003'; output; xl=500; yl=60; label='ISO 15197-2013'; output; run; /*--Merge data into one data set--*/ data plot; merge bands labels; run; ods html; proc print data=plot;run; ods html close; /*--Draw the Bands and Labels--*/ ods graphics / reset width=5in height=3in imagename='Bland_Altman_2'; proc sgplot data=plot noautolegend; title 'Blood Glucose Results'; band x=xb lower=lower upper=upper / group=Limits outline nofill; scatter x=xl y=yl / markerchar=label; refline 0; xaxis grid offsetmin=0 offsetmax=0 label='YSI Plasma Result (mg/dL)'; yaxis grid values=(-120 to 120 by 20) label='Bias from YSI (mg/dL)'; run; /*--Define some simulated data points--*/ data points; keep x y; do i=1 to 10; x=600*ranuni(2); y=240*ranuni(2)-120; output; end; run; /*--Merge all data into one data set--*/ data plot; merge bands labels points; run; ods html; proc print data=plot;run; ods html close; /*--Draw Bands, Labels and data points--*/ ods graphics / reset width=5in height=3in imagename='Bland_Altman_3'; proc sgplot data=plot noautolegend; title 'Blood Glucose Results'; band x=xb lower=lower upper=upper / group=Limits outline nofill; scatter x=x y=y; scatter x=xl y=yl / markerchar=label; refline 0; xaxis grid offsetmin=0 offsetmax=0 label='YSI Plasma Result (mg/dL)'; yaxis grid values=(-120 to 120 by 20) label='Bias from YSI (mg/dL)'; run;