<?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 FREQ McNemar test in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713216#M34471</link>
    <description>&lt;P&gt;Thanks, did not know about the zero option. I suppose that if I have raw data, then this is not going to work. I would have to count the observations in each cell first and create a data set with these summary statistics (frequencies). Then, I could use the zero option with the weighted statement.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 20:46:12 GMT</pubDate>
    <dc:creator>cminard</dc:creator>
    <dc:date>2021-01-21T20:46:12Z</dc:date>
    <item>
      <title>PROC FREQ McNemar test</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713161#M34468</link>
      <description>&lt;P&gt;Why can't SAS compute McNemar's test when zeros are in a column? I think that it is because SAS doesn't "know" that there are zeros.&lt;/P&gt;
&lt;P&gt;For example, consider the following data set for a hypothetical case-control study.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
	input caseevent controlevent number;
	cards;
	0 0 0
	0 1 9
	1 0 0
	1 1 15
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this data set, controls are matched to cases. We have 0 case-control pairs where both the case and the control do NOT have the event.&lt;/P&gt;
&lt;P&gt;There are 15 pairs where they both have the case.&lt;/P&gt;
&lt;P&gt;For discordant pairs, we have 9 instances where the control had an event, and the case did not.&lt;/P&gt;
&lt;P&gt;Also, we have 0 instances where the case had an event, and the case did not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running PROC FREQ and requesting McNemar test:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=one;
	tables caseevent*controlevent / agree;
	weight number;
	exact mcnemar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;We get the appropriate table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 346px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53757i18EE68D939CE30A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, there is no McNemar test and SAS log gives a NOTE:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 788px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53759i9BDE7F5023B0FAF7/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, apparently SAS thinks we are missing data.&lt;/P&gt;
&lt;P&gt;I can calculate McNemar test (with or without continuity correction) manually. In this case X2=(|9-0|^2)/9=9 with one degree of freedom.&lt;/P&gt;
&lt;P&gt;Or continuity corrected X2=((|9-0|-1)^2)/9=7.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, it there some way to get sas to do this without having to program it? Further, I would prefer the Exact McNemar test. But, maybe I just need to program conditional Binomial tests for this.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713161#M34468</guid>
      <dc:creator>cminard</dc:creator>
      <dc:date>2021-01-21T18:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ McNemar test</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713174#M34469</link>
      <description>&lt;P&gt;You will need to add the ZEROS option to the WEIGHT statement.&lt;/P&gt;
&lt;P&gt;proc freq data=one;&lt;BR /&gt;tables caseevent*controlevent / agree;&lt;BR /&gt;weight number/zeros;&lt;BR /&gt;exact mcnemar;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713174#M34469</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2021-01-21T18:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ McNemar test</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713216#M34471</link>
      <description>&lt;P&gt;Thanks, did not know about the zero option. I suppose that if I have raw data, then this is not going to work. I would have to count the observations in each cell first and create a data set with these summary statistics (frequencies). Then, I could use the zero option with the weighted statement.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 20:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713216#M34471</guid>
      <dc:creator>cminard</dc:creator>
      <dc:date>2021-01-21T20:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ McNemar test</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713219#M34472</link>
      <description>&lt;P&gt;Yes, with raw data you could assign a count of 1 to each observation and then add an observation with the missing row/column combination and a count of 0.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 21:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-FREQ-McNemar-test/m-p/713219#M34472</guid>
      <dc:creator>SAS_Rob</dc:creator>
      <dc:date>2021-01-21T21:05:10Z</dc:date>
    </item>
  </channel>
</rss>

