Quartz | Level 8

## Bland Altman plot on 200 variables

I have two separate datasets  of dimension 80x200. Patients and variables are identical and in the same order. We want to compare the two datasets. We want to have the Bland Altman plot on each of the variable.

In the case of comparing only one variable there is a procedure. The two measurements are included in the same dataset  (https://www.tutorialspoint.com/sas/sas_bland_altman_analysis.htm), but my data has 200 variables.

Is this something doable?

I put here two examples of dataset that I made up for illustration on how my data looks like (but with more variables).

Thank you

data1:

id,C1,C2,C3,C4
1,4.10855,5.44574,33.16678,6.75791
3,3.48004,6.29138,31.34662,10.38753
4,2.33851,5.84293,35.79064,11.0801
9,3.1966,7.15718,30.27008,7.49836

data2:

id,C1,C2,C3,C4
1,4.19855,5.74574,33.46678,6.85391
3,3.48004,6.69138,31.85662,11.73753
4,3.33851,5.74293,36.09064,10.9801
9,3.2966,8.15718,30.27008,7.62836

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Bland Altman plot on 200 variables

Please post data in the form of a data step.

This is an approach. The idea is to get data in the form of X,Y pairs, where X is from one data set and Y from the other for the same variable with an identifier as to what the original variable is. Transpose, merge, sort and plot. As long as the variables have the same name and type should be golden.

```data have1;
infile datalines dlm=',';
input id \$ C1 C2 C3 C4;
datalines;
1,4.19855,5.74574,33.46678,6.85391
3,3.48004,6.69138,31.85662,11.73753
4,3.33851,5.74293,36.09064,10.9801
9,3.2966,8.15718,30.27008,7.62836
;

data have2;
infile datalines dlm=',';
input id \$ C1 C2 C3 C4;
datalines;
1,4.19855,5.74574,33.46678,6.85391
3,3.48004,6.69138,31.85662,11.73753
4,3.33851,5.74293,36.09064,10.9801
9,3.2966,8.15718,30.27008,7.62836
;

proc transpose data=have1 out=trans1
prefix=x;
by id;
run;

proc transpose data=have1 out=trans2
prefix=y;
by id;
run;

data toplot;
merge trans1
trans2
;
by id _name_;
run;

proc sort data=toplot;
by _name_;
run;

proc sgplot data=toplot;
by _name_;
scatter x=x1 y=y1;
run;
```
4 REPLIES 4
SAS Super FREQ

## Re: Bland Altman plot on 200 variables

You say, "Patients and variables are identical and in the same order. We want to compare the two datasets."

What sort of comparisons are you trying to make? How does the second data set relate to the first?

A Bland-Altman plot is often used to compare readings made on the same subject using two different instruments. For example, two variables might be body temperature measured by using an oral thermometer versus a forehead infrared scanner.  What do your 200 variables represent?  I am assuming that you are not going to look at 200 B-A plots, so what statistical result do you want to look at for each 200 variables?

Quartz | Level 8

# It is an analytical equipment used  to run samples.  These are NMR spectra. The data originates from the integration of the area under the peaks.  Two operators separately have done these integrations and two datasets were generated.  We want to see the difference in their readings by Bland-Altman Plot

Super User

## Re: Bland Altman plot on 200 variables

Please post data in the form of a data step.

This is an approach. The idea is to get data in the form of X,Y pairs, where X is from one data set and Y from the other for the same variable with an identifier as to what the original variable is. Transpose, merge, sort and plot. As long as the variables have the same name and type should be golden.

```data have1;
infile datalines dlm=',';
input id \$ C1 C2 C3 C4;
datalines;
1,4.19855,5.74574,33.46678,6.85391
3,3.48004,6.69138,31.85662,11.73753
4,3.33851,5.74293,36.09064,10.9801
9,3.2966,8.15718,30.27008,7.62836
;

data have2;
infile datalines dlm=',';
input id \$ C1 C2 C3 C4;
datalines;
1,4.19855,5.74574,33.46678,6.85391
3,3.48004,6.69138,31.85662,11.73753
4,3.33851,5.74293,36.09064,10.9801
9,3.2966,8.15718,30.27008,7.62836
;

proc transpose data=have1 out=trans1
prefix=x;
by id;
run;

proc transpose data=have1 out=trans2
prefix=y;
by id;
run;

data toplot;
merge trans1
trans2
;
by id _name_;
run;

proc sort data=toplot;
by _name_;
run;

proc sgplot data=toplot;
by _name_;
scatter x=x1 y=y1;
run;
```
Quartz | Level 8

## Re: Bland Altman plot on 200 variables

get this error message at when running proc sgplot:

ERROR: Java virtual machine exception. java.lang.NoClassDefFoundError: Could not initialize class
com.sas.graphics.applets.statgraph.sgchart.data.DataModel.

Discussion stats
• 4 replies
• 531 views
• 0 likes
• 3 in conversation