<?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: proc surveyfreq and multiple comparisons in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631989#M30296</link>
    <description>&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;You will need to subset the data to get the 2x2 comparisons and then run SURVEYFREQ independently for each comparison. &amp;nbsp;The trick however is that in subsetting, you will need to make sure you treat the groups as true subgroups (i.e. domains) in order to make sure the standard errors are correct. &amp;nbsp;To do this, you will need to set all the groups not in the comparison to missing and then use the NOMCAR option on the SURVEYFREQ statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;Roughly speaking it would look like this, creating a new variable for each comparison.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;data new;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;set old;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;if category in ('A', 'B') then newcatab=category;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;else newcatab=.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;proc surveyfreq data=new nomcar;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;tables newcatab*sex ....;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Mar 2020 17:30:29 GMT</pubDate>
    <dc:creator>SAS_Rob</dc:creator>
    <dc:date>2020-03-13T17:30:29Z</dc:date>
    <item>
      <title>proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631982#M30295</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are working with survey data and we want to know if the proportions of&amp;nbsp; categories A, B and C are different for dependent variable which is (Y/N). Is there a way to test if the proportions between A and B and A and C are statistically significant? Or can we subset the data and run a simple chisq between A and B and another test for A and C?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc surveyfreq data = sample1;&lt;BR /&gt;table DV*Categories/col row nostd nowt chisq ;&lt;BR /&gt;weight WTS_P;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 17:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631982#M30295</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2020-03-13T17:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631989#M30296</link>
      <description>&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;You will need to subset the data to get the 2x2 comparisons and then run SURVEYFREQ independently for each comparison. &amp;nbsp;The trick however is that in subsetting, you will need to make sure you treat the groups as true subgroups (i.e. domains) in order to make sure the standard errors are correct. &amp;nbsp;To do this, you will need to set all the groups not in the comparison to missing and then use the NOMCAR option on the SURVEYFREQ statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;Roughly speaking it would look like this, creating a new variable for each comparison.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;data new;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;set old;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;if category in ('A', 'B') then newcatab=category;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;else newcatab=.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;proc surveyfreq data=new nomcar;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;tables newcatab*sex ....;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="cs95E872D0"&gt;&lt;SPAN class="cs53F207AF"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 17:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631989#M30296</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2020-03-13T17:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631997#M30297</link>
      <description>&lt;P&gt;Thank you very much! It worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 17:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/631997#M30297</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2020-03-13T17:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632521#M30317</link>
      <description>&lt;P&gt;Sorry, it ran, but I am not sure how to interpret the output. I don't think it is comparing the proportions of A and B, but it is comparing A with all the other groups lumped together:&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample2;&lt;BR /&gt;set sample1;&lt;BR /&gt;if CAT in ('A', ' B') then CAT2=CAT;&lt;BR /&gt;else CAT2=.;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;ods graphics off;&lt;BR /&gt;proc surveyfreq data=sample2 nomcar;&lt;BR /&gt;tables CAT2*SEX/col row nostd nowt wchisq chisq;&lt;BR /&gt;weight WTS_P;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the output:&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="Capture.PNG" style="width: 451px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36920i89FFC1104847A648/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to compare the row percents of A with B, A with C and A with D. This is the table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36921i8EB43D2275E60C69/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to do these comparisons making sure, as you said before, with the correct standard errors?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 19:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632521#M30317</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2020-03-16T19:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632626#M30320</link>
      <description>&lt;P&gt;There is something odd about the output that you attached.&amp;nbsp; It appears to be for a different table, namely, ANIMALCAT2*EAR_F_PROTEIN.&amp;nbsp; Can you double-check to make sure you are looking at the right output.&amp;nbsp; The other thing I would check is that you have properly subsetted.&amp;nbsp; Here is an example using that table you sent.&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;do animalcat='A','B','C','D';&lt;BR /&gt;do sex='M','F';&lt;BR /&gt;input count;&lt;BR /&gt;do i=1 to count;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;datalines;&lt;BR /&gt;67&lt;BR /&gt;51&lt;BR /&gt;424&lt;BR /&gt;166&lt;BR /&gt;1612&lt;BR /&gt;155&lt;BR /&gt;920&lt;BR /&gt;30&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;data subset;&lt;BR /&gt;set test;&lt;BR /&gt;if animalcat in ('A','B') then animalcat2=animalcat;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc surveyfreq data=subset;&lt;BR /&gt;tables animalcat*sex;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc surveyfreq data=subset nomcar;&lt;BR /&gt;tables animalcat2*sex;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 11:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632626#M30320</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2020-03-17T11:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632704#M30325</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I didn't copy the right output. How can I check I'm sub-setting the data correctly? It will be more efficient if I did not have to copy the datalines since this is a huge data set and I have to run tests multiple times with different dependent variables. You mentioned before that it is important to include the other groups that are not being compared as missing values. Why is this missing on the last code?&lt;/P&gt;&lt;P&gt;This is the code that I used:&lt;/P&gt;&lt;P&gt;data sample2;&lt;BR /&gt;set sample1;&lt;BR /&gt;if ANIMALCAT in ('A', 'B') then ANIMALCAT2=ANIMALCAT;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics off;&lt;BR /&gt;proc surveyfreq data=sample1;&lt;BR /&gt;tables ANIMALCAT*EAR_F_PROTEIN/col row nostd nowt wchisq chisq;&lt;BR /&gt;weight WTS_P;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics off;&lt;BR /&gt;proc surveyfreq data=sample2 nomcar;&lt;BR /&gt;tables ANIMALCAT2*EAR_F_PROTEIN/col row nostd nowt wchisq chisq;&lt;BR /&gt;weight WTS_P;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the output for the last proc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36940i850CB6954DD8A3D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How can I compare A and B, A and C and A and D?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 15:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632704#M30325</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2020-03-17T15:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc surveyfreq and multiple comparisons</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632755#M30326</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I figure what was wrong. I left a space between the quotation and the category B&lt;/P&gt;&lt;P&gt;data sample2;&lt;BR /&gt;set sample1;&lt;BR /&gt;if ANIMALCAT in ('A', '&amp;nbsp; B') then ANIMALCAT2=ANIMALCAT;&lt;BR /&gt;else ANIMALCAT2='.';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now without the space I get the right output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample2;&lt;BR /&gt;set sample1;&lt;BR /&gt;if ANIMALCAT in ('A', 'B') then ANIMALCAT2=ANIMALCAT;&lt;BR /&gt;else ANIMALCAT2='.';&lt;BR /&gt;RUN;&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="Capture.PNG" style="width: 589px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36946i5D4F1307930937A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36947iA5AF65709227010A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So this is comparing A and B taking into account the other two groups for standard errors, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please confirm I am interpreting this correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 18:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/proc-surveyfreq-and-multiple-comparisons/m-p/632755#M30326</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2020-03-17T18:32:44Z</dc:date>
    </item>
  </channel>
</rss>

