BookmarkSubscribeRSS Feed
littlestone
Fluorite | Level 6
Dear All

Suppose I have following data set:

data test;
input row col count;
cards;
1 1 11
1 2 4
2 1 13
2 2 1
;
run;

Because this data set violates the proportion test assumption, I need to do continuity correction; and I also need to perform one sided test.

So I ran following codes:

proc freq data=test;
tables row*col/riskdiffc (EQUAL);
weight count;
run;

The one-sided p-value I got from running this SAS code is 0.1719.

However when I try to solve the exactly same problem using R, I got one-sided p-value=0.8157.

My question is: why the p-values from SAS and R are different?

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.

Did I make any mistake in my SAS coding?
2 REPLIES 2
Paige
Quartz | Level 8
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"?

Maybe you made a mistake in your R coding?

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
Doc_Duke
Rhodochrosite | Level 12
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.

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2159 views
  • 0 likes
  • 3 in conversation