Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Re: chisq test and fisher exact test from proc freq

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-09-2019 04:09 PM
(3089 views)

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

10 REPLIES 10

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Reeza,

Sorry for my typo. I did add "chisq" in table statement, but no "fisher exact".

Thanks,

Joe

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

OR

Fisher or Exact is specified.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

And you can use ODS SELECT/EXCLUDE to control the output if you don't want a specific table or such for a report.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@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.

**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.

What is Bayesian Analysis?

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.