Hi,
I am a little stuck with creating a Bland-Altmann plot.
I have used the following script : https://www.tutorialspoint.com/sas/sas_bland_altman_analysis.htm
However when I create the graph, no upper limit or mean reference line is displayed.
Here is the code I have used and attached you can find the values for the 2 methos I wish to compare :
************************************************
** Get the mean and standard deviation of the **
** difference Method1-Method2. **
************************************************;
proc means data=diffs mean std noprint;
var diff_carb;
output out=mdiff mean=mdiff_carb
std=sddiff_carb;
run;
proc print data = mdiff ;
run;
*************************************************
** Merge the mean and standard deviation of the **
** difference with each observation in the **
** original data file. **
*************************************************;
data datafile2;
if _n_=1 then set mdiff;
set diffs;
lldiffm1m22=mdiff_carb-(2*sddiff_carb);
uldiffm1m22=mdiff_carb+(2*sddiff_carb);
drop _freq_ _type_;
run;
proc print data = datafile2;
run;
********************************************************************
** Create the Bland Altman Plot with **
** scatter of the difference vs the mean for each observation **
** a reference line at 0 in solid blue **
** a reference line at the mean of the difference in solid red **
** a reference line at +/- 2SD of the mean of the difference in **
** dashed red **
********************************************************************;
proc sgplot data=datafile2;
scatter x=mean_carb y=diff_carb;
refline uldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt) label = "95% upper limit" ;
refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt) label = "95% lower limit" ;
refline mdiff_carb / axis=y lineattrs=(color=red thickness=2pt) label = " mean difference " ;
refline 0 / axis=y lineattrs=(color=blue thickness=2pt) label = "zero bias ";
yaxis label='Difference (MFPQC-Nubel)';
yaxis values = (-95 35 ) ;
xaxis label='Mean (MFPQC+Nubel)/2';
title 'Bland-Altman Plot of Difference (MFPQC-Nubel) vs Mean';
run;
Thank you!!