Hi,
I was running proc freq for one categorical variable and a list of categories variables without specifying options "chisq" or "exact", and found SAS only print out chisq table for some variable but print out both chisq & fisher exact tables though no expected values in cells less than 5.
My question is why SAS sometimes print out chisq table only , sometimes print out both chisq and fisher exact table.
My code is like as below:
Proc freq data=data;
tables A*(B C D E F G H I M N);run;
Thanks,
Jason
If you have a TABLES statement, as in your code, without any chisq or fisher it doesn't print out any statistical tests. Are you sure your version is doing that?
For example, this just generates the cross tabs, is that what you get too?
proc freq data=sashelp.cars;
tables origin*(make cylinders type drivetrain);
run;
@joe66 wrote:
Hi,
I was running proc freq for one categorical variable and a list of categories variables without specifying options "chisq" or "exact", and found SAS only print out chisq table for some variable but print out both chisq & fisher exact tables though no expected values in cells less than 5.
My question is why SAS sometimes print out chisq table only , sometimes print out both chisq and fisher exact table.
My code is like as below:
Proc freq data=data;
tables A*(B C D E F G H I M N);run;
Thanks,
Jason
Hi Reeza,
Sorry for my typo. I did add "chisq" in table statement, but no "fisher exact".
Thanks,
Joe
I would be interested in seeing a log where Proc Freq generates chisq or fisher tests without being requested.
From the documentation of Proc Freq and the Fisher option:
FISHER
requests Fisher’s exact test for tables that are larger than 2x2 . (For 2x2 tables, the CHISQ option provides Fisher’s exact test.)
So if the tables you did not get a separate table for the Fisher statists only had 2 rows and 2 columns of values that is why: the chisq has all of the information available and a separate Fisher table would only duplicate it.
Hi Balldraw,
Thanks for reply!
I only include "chisq" option in tables statement. After double check my output, I found all the 2*2 tables have both chisq and fisher statistics, but no fisher statistics for those with more than two categories.
In the 2*2 tables, chisq p values are almost same or exactly same as Fisher's two tailed p values. Does it mean SAS gives both chisq and Fisher statistcs in default for 2*2 tables, even though their statistics are same?
For those more than 2 levels tables, I have to request "Fisher"?
Jason
I have no idea why you are getting any Fisher results if not explicitly requesting them. With my SAS 9.4 and earlier, going back to SAS 5.18 I haven't ever seen that happen unless another option such as an EXACT statement or the FISHER is requested.
If you want Fisher statistics for tables larger than 2x2 I would expect the FISHER option on the tables statement or an EXACT statement with the Fisher option.
Hi Balldraw,
I just checked SAS document of Freq procedure,link as below. It does not request fisher in tables statement, but SAS still generates both chisq and fisher statistics.
I feel confused that I do not know the rules when SAS will show both statistics or only show Chisq statistics under the condition only specify the option "chisq".
Thanks again.
Jason
Fishers exact is generated if the Chi-Square option is specified AND it is a 2x2 table
OR
Fisher or Exact is specified.
Hi Jason,
Did you figure out which one you would use if your output presents tables for chisquare and fishers? I have the same problem, where I will indicate chisq in my code but get both tables in my results.
Thanks!
@varatt90 wrote:
Hi Jason,
Did you figure out which one you would use if your output presents tables for chisquare and fishers? I have the same problem, where I will indicate chisq in my code but get both tables in my results.
Thanks!
First, time to ask a new question. The original poster of this topic has not been on the forum since 2020.
Second, in your new question post your exact code and all messages from from the LOG. Copy the Log text an on the forum open a text box using the </> icon above the message window and paste the text.
Third, explain was the problem is with getting Fishers Exact test information.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: