Dear Experts,
I used the Fisher Exact test to estimate the significance of 2 variables. It returns exact pValue but I failed to get the Odds ratio for the method.
proc freq data=Beact.AllinOne;
tables var1*var2 / fisher norow nocol;
run;
Kindly suggest the key code to get the Odds ratio for Fisher Exact Test.
Thanks in advance!
Add the EXACT statement and specify the OR option:
EXACT OR;
You can also add OR to the TABLES statement to get the conventional estimates.
Add the EXACT statement and specify the OR option:
EXACT OR;
You can also add OR to the TABLES statement to get the conventional estimates.
Thank you for your response @Rick_SAS . It works well.
I need one more clarification. Once I get the odds ratio using OR and Exact, I just cross verified with Fisher Exact in R programming.
It returns the same pValue but different Odds ratio. May I know why it differs in the Odds ratio?
I do not know, but here is a link to the PROC FREQ documentation that shows the formulas related to the odds ratio..The OR computation is pretty standard. Did you mean the confidence limits for the OR? SAS supports multiple CIs and sometimes the defaults used by one software differ from the results used by another software package.
All I can suggest is that you find the documentation for whatever R functions you are using and find out how they compute the OR (or CIs for the OR).
It appears SAS FREQ computes the odds ratio solely as the usual OR=(ad)/(bc) method. It does not provide the "exact" OR maximum likelihood estimate which is from Fisher's non-central hypergeometric distribution. These are not the same. It does appear as though SAS will estimate the "exact" confidence limits using Fisher's non-central hypergeometric distribution, but for some reason does not provide the MLE for the OR. The pmf from Fisher's non-central hypergeometric distribution can be considered a likelihood with the OR as the parameter. This is what the fisher.test() function uses in R.
Can SAS add this to SAS/STAT or make it clear how to extract the "exact" OR if this approach already exists?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.