<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Intraclass correlation for two variables in a data set without a data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841291#M332646</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1666956882693.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76718i13B480ED82230420/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1666956882693.png" alt="Ksharp_0-1666956882693.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2022 11:34:15 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2022-10-28T11:34:15Z</dc:date>
    <item>
      <title>Intraclass correlation for two variables in a data set without a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841014#M332520</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data variables/ columns in the data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp;X&amp;nbsp; Y X1 Y1 X2 Y2 X3 Y3....X34 Y34&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a bunch in advance!&lt;/P&gt;&lt;P&gt;SM&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 19:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841014#M332520</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2022-10-26T19:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Intraclass correlation for two variables in a data set without a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841120#M332569</link>
      <description>&lt;P&gt;&lt;A href="https://support.sas.com/kb/25/031.html" target="_blank"&gt;https://support.sas.com/kb/25/031.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/30/333.html#errinvar" target="_blank"&gt;https://support.sas.com/kb/30/333.html#errinvar&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1666872265412.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76689iC859E2D200C2E0C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1666872265412.png" alt="Ksharp_0-1666872265412.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 12:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841120#M332569</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-27T12:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Intraclass correlation for two variables in a data set without a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841165#M332582</link>
      <description>&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 15:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841165#M332582</guid>
      <dc:creator>sms1891</dc:creator>
      <dc:date>2022-10-27T15:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Intraclass correlation for two variables in a data set without a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841291#M332646</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1666956882693.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76718i13B480ED82230420/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1666956882693.png" alt="Ksharp_0-1666956882693.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 11:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intraclass-correlation-for-two-variables-in-a-data-set-without-a/m-p/841291#M332646</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-28T11:34:15Z</dc:date>
    </item>
  </channel>
</rss>

