Dear experts,
I need to find the intraclass correlation coefficient (ICC) between two different variable (X vs Y) in a data set. I have a list of 10 subjects and measurements were taken at time1 (variable X) and at time2 (variable Y). Similarly I have to compare X1 vs Y1, X2 vs Y2,....X34 vs Y34. I would really appreciate your help with this. I do not want to do a data step for each of these comparisons 34 times. Is there a better way to handle this?
Data variables/ columns in the data set:
ID X Y X1 Y1 X2 Y2 X3 Y3....X34 Y34
1
2
3
4
5
6
7
8
9
10
Thanks a bunch in advance!
SM
Thanks for the reply and the link Ksharp, but I am still confused. Do you have any examples which fit my case scenario and output interpretation?
Ksharp:
/*According to the example from URL,
You need to change your data structure .
Did you read it ?
*/
data have;
input id x1 y1 x2 y2 x3 y3;
output;
datalines;
1 5.9 5.8 5.5 5.6 5.4 5.5
2 5.9 5.7 5.7 5.8 5.5 5.2
3 5.9 5.8 5.7 5.6 5.4 5.2
4 5.9 5.7 5.8 5.7 5.4 5.3
5 5.8 5.7 5.3 5.4 5.4 5.1
6 5.8 5.7 5.6 5.6 5.4 5.4
7 5.9 5.8 5.5 5.3 5.4 5.2
8 5.9 5.8 5.7 5.6 5.4 5.2
9 5.9 5.8 5.3 5.7 5.5 5.3
;
proc transpose data=have out=temp;
by id;
var x: y:;
run;
data want;
set temp;
by=compress(_name_,,'kd');
if _name_=:'x' then time=1;
if _name_=:'y' then time=2;
run;
proc sort data=want;
by by id time;
run;
proc nested data=want;
by by;
class id;
var col1;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.