# SAS Bland-Altman Analysis | SAS Bland Altman Plot

We looked at t-tests, correlation and regression in the previous tutorials, today we will be looking at another process called SAS Bland Altman Analysis and how to create SAS Bland Altman plot.

At last, we will discuss PROC SGPLOT Procedure in SAS Programming Language with SAS Bland Altman Plot example.

So let us get started.

## What is SAS Bland Altman Analysis

SAS Bland-Altman analysis is not a statistical test, instead, it is a process used to assess agreement between two methods of measurement.

An important requirement of the Bland-Altman method for measuring agreement is that the two methods for measuring the same characteristic use the same scale of measurement.  This implies that when plotted, the points should line up along the line y = x (line of identity).

SAS Bland Altman analysis is based on examination of two plots:

1. Plot of identity: A scatterplot of the two measurements along with the line y = x. If the measurements are in basic agreement then the points in the scatterplot will line up closer to the line y = x.
1. Bland-Altman plotA scatterplot of variable means plotted on the horizontal axis and the differences plotted on the vertical axis which shows the amount of disagreement between the two measures and lets you see how this disagreement relates to the magnitude of the measurements.  SAS Blend Altman plot includes approximate 95% limits.

Join DataFlair on Telegram!!

## SAS PROC SGPLOT Procedure

We create a SAS Bland Altman plot by first calculating the mean, upper limit and lower limit of the variable values. We then use PROC SGPLOT to create the Bland Altman plot in SAS.

SAS Proc SGPLOT Syntax-

```PROC SGPLOT DATA = dataset;
SCATTER X=variable Y=Variable;
REFLINE value;```

Here scatter will create a scatterplot like we saw earlier an refline will create a reference line either on horizontal or vertical axis.

## SAS Bland Altman Plot

In the below example we calculate the differences in the values of the variables and also the mean of the variables of the same observation. We also calculate the standard deviation values to be used in the upper and lower limit of the calculation.

SAS Bland Altman Plot Example-

```data  temp;
input new old;
datalines;
23 34
23 14
16 77
35 85
23 80
27 15
30 11
26 42
37 35
20 9
34 54
61 67
45 25
77 64
45 53
;
data differ ;
set  temp ;
/* calculate the difference */
diff=new-old ;
/* calculate the average */
mean=(new+old)/2 ;
run ;
proc print data=differs;
run;
proc sql noprint ;
select mean(diff)-2*std(diff),  mean(diff)+2*std(diff)
into   :lower,  :upper
from differs ;
quit;
proc sgplot data=differs ;
scatter x=mean y=diff;
refline 0 &upper &lower ;
TITLE 'Bland-Altman Plot';
run ;
quit ;```

a. An enhanced version of the SAS Bland Altman plot
In the enhanced version, the curve is fitted.

Example-

```proc sgplot data=differs;
reg x = new y = diff;
needle x= new y=diff;
refline 0;
TITLE 'Enhanced Bland-Altman Plot';
run;
quit;```

This was all about SAS Bland Altman Analysis Tutorial. Hope you like our explanation of SAS Bland Altman Plot.

## Conclusion

Hence, we hope you all understood what is SAS Bland-Altman analysis and how can we create a SAS bland Altman plot. We also saw how the plot can be enhanced.

For any queries post your doubts in the comments section below and stay tuned to learn more interesting things in SAS Programming Language.