BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Job04
Quartz | Level 8

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
ballardw
Super User

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;

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

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?

 

 

Job04
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

ballardw
Super User

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;
Job04
Quartz | Level 8

 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.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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