<?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: Chi-square for clustered data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527635#M143892</link>
    <description>Actually each eye may or may not have the condition (disease was probably the wrong word, sorry). I am thinking it should be a GEE model for binary outcome to account for eye correlation.</description>
    <pubDate>Wed, 16 Jan 2019 04:52:54 GMT</pubDate>
    <dc:creator>Melk</dc:creator>
    <dc:date>2019-01-16T04:52:54Z</dc:date>
    <item>
      <title>Chi-square for clustered data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527613#M143872</link>
      <description>&lt;P&gt;I have some eye-level data and I just want to run a simple chi-square comparing the proportion of disease X between race. Since the data is clustered, is there an option I can use in proc freq to adjust for the correlation of eyes between patients?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; EYE&amp;nbsp; &amp;nbsp; X&amp;nbsp; &amp;nbsp; RACE&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; L&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;W&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; L&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;W&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 03:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527613#M143872</guid>
      <dc:creator>Melk</dc:creator>
      <dc:date>2019-01-16T03:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Chi-square for clustered data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527633#M143891</link>
      <description>&lt;P&gt;I presume that "having the disease" is signified by both eyes having X=1, or either eye have X=1, correct?&amp;nbsp; If so, create one record per person, with a new variable NEWX, which takes the maximum value of X for each ID.&amp;nbsp; Then you can proc freq, crosstabulating newx with race.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID    EYE :$1.     X    RACE :$1.;
datalines;
1        R       0        A
1        L       0        A
2        R      1       W
2        L       0       W
run;

data want (drop=eye);
  set have (where=(x=0))
      have (where=(x=1));
  by id;
  if last.id;
  rename x=new_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data step above interleaves all the X=0 records with the X=1 records, within each by group.&amp;nbsp; So no matter the original order of x values within an id, the incoming data will present the X=1 record last, if there is an x=1 record.&amp;nbsp; Otherwise the last record for the id will be an x=0:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This program depends on the data being sorted by ID, but it doesn't care about the order of X within id, nor the order or R vs L within the id.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 04:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527633#M143891</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-01-16T04:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Chi-square for clustered data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527635#M143892</link>
      <description>Actually each eye may or may not have the condition (disease was probably the wrong word, sorry). I am thinking it should be a GEE model for binary outcome to account for eye correlation.</description>
      <pubDate>Wed, 16 Jan 2019 04:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Chi-square-for-clustered-data/m-p/527635#M143892</guid>
      <dc:creator>Melk</dc:creator>
      <dc:date>2019-01-16T04:52:54Z</dc:date>
    </item>
  </channel>
</rss>

