<?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 why the results from R and SAS are different (  2 sample proportion test) in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71545#M3459</link>
    <description>Dear All&lt;BR /&gt;
&lt;BR /&gt;
Suppose I have following data set:&lt;BR /&gt;
&lt;BR /&gt;
data test; &lt;BR /&gt;
input row col count; &lt;BR /&gt;
cards; &lt;BR /&gt;
1 1 11&lt;BR /&gt;
1 2 4&lt;BR /&gt;
2 1 13 &lt;BR /&gt;
2 2 1&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Because this data set violates the proportion test assumption, I need to do continuity correction; and I also need to perform one sided test. &lt;BR /&gt;
&lt;BR /&gt;
So I ran following codes:&lt;BR /&gt;
&lt;BR /&gt;
proc freq data=test; &lt;BR /&gt;
tables row*col/riskdiffc (EQUAL); &lt;BR /&gt;
weight count; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The one-sided p-value I got from running this SAS code is 0.1719.&lt;BR /&gt;
&lt;BR /&gt;
However when I try to solve the exactly same problem  using R, I got one-sided p-value=0.8157.&lt;BR /&gt;
&lt;BR /&gt;
My question is: why the p-values from SAS and R are different?&lt;BR /&gt;
 &lt;BR /&gt;
Personally  I think p-value=0.8157 (from R) is correct, as proportion1 is greater than proportion2 suggesting the p-value should be greater than 0.5.&lt;BR /&gt;
&lt;BR /&gt;
Did I make any mistake in my SAS coding?</description>
    <pubDate>Wed, 01 Jun 2011 01:33:28 GMT</pubDate>
    <dc:creator>littlestone</dc:creator>
    <dc:date>2011-06-01T01:33:28Z</dc:date>
    <item>
      <title>why the results from R and SAS are different (  2 sample proportion test)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71545#M3459</link>
      <description>Dear All&lt;BR /&gt;
&lt;BR /&gt;
Suppose I have following data set:&lt;BR /&gt;
&lt;BR /&gt;
data test; &lt;BR /&gt;
input row col count; &lt;BR /&gt;
cards; &lt;BR /&gt;
1 1 11&lt;BR /&gt;
1 2 4&lt;BR /&gt;
2 1 13 &lt;BR /&gt;
2 2 1&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Because this data set violates the proportion test assumption, I need to do continuity correction; and I also need to perform one sided test. &lt;BR /&gt;
&lt;BR /&gt;
So I ran following codes:&lt;BR /&gt;
&lt;BR /&gt;
proc freq data=test; &lt;BR /&gt;
tables row*col/riskdiffc (EQUAL); &lt;BR /&gt;
weight count; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The one-sided p-value I got from running this SAS code is 0.1719.&lt;BR /&gt;
&lt;BR /&gt;
However when I try to solve the exactly same problem  using R, I got one-sided p-value=0.8157.&lt;BR /&gt;
&lt;BR /&gt;
My question is: why the p-values from SAS and R are different?&lt;BR /&gt;
 &lt;BR /&gt;
Personally  I think p-value=0.8157 (from R) is correct, as proportion1 is greater than proportion2 suggesting the p-value should be greater than 0.5.&lt;BR /&gt;
&lt;BR /&gt;
Did I make any mistake in my SAS coding?</description>
      <pubDate>Wed, 01 Jun 2011 01:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71545#M3459</guid>
      <dc:creator>littlestone</dc:creator>
      <dc:date>2011-06-01T01:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: why the results from R and SAS are different (  2 sample proportion test)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71546#M3460</link>
      <description>I can't say if you made a mistake in your SAS coding until you tell us the exact hypothesis you want to test in SAS. What is "proportion1" and what is "proportion2"?&lt;BR /&gt;
&lt;BR /&gt;
Maybe you made a mistake in your R coding?&lt;BR /&gt;
&lt;BR /&gt;
Maybe SAS and R aren't programmed to do the same thing, in which case the results wouldn't match. Maybe they use different algorithms to answer the same question.

Message was edited by: Paige</description>
      <pubDate>Wed, 01 Jun 2011 12:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71546#M3460</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2011-06-01T12:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: why the results from R and SAS are different (  2 sample proportion test)</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71547#M3461</link>
      <description>There have been several books written on the analysis of 2x2 tables with 10's of different methods for continuity adjustment, so it is not surprising that the numbers don't match exactly.&lt;BR /&gt;
&lt;BR /&gt;
The answers that you got are actually close.  R and SAS just reversed the names for proportion 1 and 2 so they were looking at opposite tails in the one-tailed environment.</description>
      <pubDate>Wed, 01 Jun 2011 14:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/why-the-results-from-R-and-SAS-are-different-2-sample-proportion/m-p/71547#M3461</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2011-06-01T14:09:24Z</dc:date>
    </item>
  </channel>
</rss>

