<?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 Chi square test for difference in proportions between two groups in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30534#M1247</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I want to test whether there is a significant difference in proportions between two groups at each level of a 20-level variable.  I've been trying to use proc surveyfreq with the code below, but it isn't providing the results for the chisquare test (only frequencies and standard errors for each level of the variable).  &lt;BR /&gt;
&lt;BR /&gt;
proc surveyfreq data=new;&lt;BR /&gt;
tables group*variable / chisq;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any suggestions for how to do this and ensure that the hypotheses I'm testing are for differences at each level of the 20-level variable between the two groups (ie, so I get a separate p-value for each of the 20 levels)?&lt;BR /&gt;
Thanks!!&lt;BR /&gt;
Nicole</description>
    <pubDate>Mon, 14 Dec 2009 20:52:15 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-12-14T20:52:15Z</dc:date>
    <item>
      <title>Chi square test for difference in proportions between two groups</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30534#M1247</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I want to test whether there is a significant difference in proportions between two groups at each level of a 20-level variable.  I've been trying to use proc surveyfreq with the code below, but it isn't providing the results for the chisquare test (only frequencies and standard errors for each level of the variable).  &lt;BR /&gt;
&lt;BR /&gt;
proc surveyfreq data=new;&lt;BR /&gt;
tables group*variable / chisq;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any suggestions for how to do this and ensure that the hypotheses I'm testing are for differences at each level of the 20-level variable between the two groups (ie, so I get a separate p-value for each of the 20 levels)?&lt;BR /&gt;
Thanks!!&lt;BR /&gt;
Nicole</description>
      <pubDate>Mon, 14 Dec 2009 20:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30534#M1247</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-14T20:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Chi square test for difference in proportions between two groups</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30535#M1248</link>
      <description>&amp;gt; Hi,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I want to test whether there is a significant&lt;BR /&gt;
&amp;gt; difference in proportions between two groups at each&lt;BR /&gt;
&amp;gt; level of a 20-level variable.  I've been trying to&lt;BR /&gt;
&amp;gt; use proc surveyfreq with the code below, but it isn't&lt;BR /&gt;
&amp;gt; providing the results for the chisquare test (only&lt;BR /&gt;
&amp;gt; frequencies and standard errors for each level of the&lt;BR /&gt;
&amp;gt; variable).  &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; proc surveyfreq data=new;&lt;BR /&gt;
&amp;gt; tables group*variable / chisq;&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Does anyone have any suggestions for how to do this&lt;BR /&gt;
&amp;gt; and ensure that the hypotheses I'm testing are for&lt;BR /&gt;
&amp;gt; differences at each level of the 20-level variable&lt;BR /&gt;
&amp;gt; between the two groups (ie, so I get a separate&lt;BR /&gt;
&amp;gt; p-value for each of the 20 levels)?&lt;BR /&gt;
&amp;gt; Thanks!!&lt;BR /&gt;
&amp;gt; Nicole&lt;BR /&gt;
&lt;BR /&gt;
My first question is why you are using SURVEYFREQ when you have no cluster or strata statements, you could just use FREQ. &lt;BR /&gt;
&lt;BR /&gt;
My second question is whether you could show us some of the log? Any errors or warnings?  You ought to get some sort of chisq test with this code&lt;BR /&gt;
&lt;BR /&gt;
Third, AFAIK you don't get a separate p-value for each of the 20 levels.  I know you don't get this with FREQ.   If you want something like this, you need  a different PROC.  Perhaps LOGISTIC or SURVEYLOGISTIC or something.&lt;BR /&gt;
&lt;BR /&gt;
Finally, what's your sample size?  20 levels is a lot.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
&lt;BR /&gt;
Peter</description>
      <pubDate>Tue, 15 Dec 2009 23:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30535#M1248</guid>
      <dc:creator>plf515</dc:creator>
      <dc:date>2009-12-15T23:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Chi square test for difference in proportions between two groups</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30536#M1249</link>
      <description>Proportions different from what?  &lt;BR /&gt;
&lt;BR /&gt;
If you want to see if the proportions are equal to one another at each level, then you are effectively testing that the proportion in group 1 is equal to 0.50 at each level.  You can do that with PROC FREQ (using BINOMIAL option on TABLES statement) and using the 20-level variable as a BY variable.&lt;BR /&gt;
&lt;BR /&gt;
If one of your levels is "control" and the other 19 are various 'treatments," you could test whether each treatment is different from the control level using the CONTRAST statement in GENMOD.&lt;BR /&gt;
&lt;BR /&gt;
The tests are asymptotic, so you'll need a fairly large sample size.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Wed, 16 Dec 2009 23:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30536#M1249</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-12-16T23:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Chi square test for difference in proportions between two groups</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30537#M1250</link>
      <description>Thanks so much for your response.  Here are a few points that hopefully clarify what I'm trying to get at:&lt;BR /&gt;
&lt;BR /&gt;
I have two groups that differ in size as well as along my main covariate of interest (n=386 in Group 1 and n=737 in Group 2).  I would like to see if the frequencies of subjects (out of the total number of subjects in each Group) is significantly different between groups at each Level of a 20-level variable.  None of the Levels of the 20-level variable are control or treatment groups.  So essentially I want to test whether:&lt;BR /&gt;
&lt;BR /&gt;
Proportion at Level 1 (out of the total n=386 in Group 1) = Proportion at Level 1 (out of the total n=737 in Group 2)&lt;BR /&gt;
...etc...&lt;BR /&gt;
Proportion at Level 20 (out of the total n=386 in Group 1) = Proportion at Level 20 (out of the total n=737 in Group 2)&lt;BR /&gt;
&lt;BR /&gt;
Would PROC LOGISTIC do the trick (ie, code below), by using the Wald Chi Square p-value in the output?  &lt;BR /&gt;
&lt;BR /&gt;
proc logistic data=new;&lt;BR /&gt;
by level;&lt;BR /&gt;
class level;&lt;BR /&gt;
model group=level;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks so much for any suggestions you can provide.&lt;BR /&gt;
NG</description>
      <pubDate>Mon, 21 Dec 2009 20:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30537#M1250</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-21T20:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Chi square test for difference in proportions between two groups</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30538#M1251</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
You can't have both BY LEVEL and LEVEL in your model statement.  That would lead to an error, because you would be stratifying on the variable you are trying to model.&lt;BR /&gt;
&lt;BR /&gt;
You could do the same thing only without the BY statement, or you could do a PROC FREQ with a BY STATEMENT&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
&lt;BR /&gt;
Peter</description>
      <pubDate>Mon, 21 Dec 2009 23:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30538#M1251</guid>
      <dc:creator>plf515</dc:creator>
      <dc:date>2009-12-21T23:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Chi square test for difference in proportions between two groups</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30539#M1252</link>
      <description>In PROC LOGISTIC you would actually make your 20-level variable the response, your binary group variable the predictor, and fit a generalized logit model:&lt;BR /&gt;
&lt;BR /&gt;
proc logistic;&lt;BR /&gt;
  class group / param=ref;&lt;BR /&gt;
  model level = group / link=glogit;&lt;BR /&gt;
  run;&lt;BR /&gt;
&lt;BR /&gt;
The tests of the GROUP parameter estimates are tests comparing the groups at each level.</description>
      <pubDate>Fri, 15 Jan 2010 21:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Chi-square-test-for-difference-in-proportions-between-two-groups/m-p/30539#M1252</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2010-01-15T21:04:19Z</dc:date>
    </item>
  </channel>
</rss>

