BookmarkSubscribeRSS Feed
joe66
Calcite | Level 5

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
Reeza
Super User

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


 

joe66
Calcite | Level 5

Hi Reeza,

 

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

 

Thanks,

 

Joe

ballardw
Super User

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.

joe66
Calcite | Level 5

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

ballardw
Super User

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.

joe66
Calcite | Level 5

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.

 

http://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=procstat&docsetTarget=proc...

 

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

Reeza
Super User

Fishers exact is generated if the Chi-Square option is specified AND it is a 2x2 table
OR
Fisher or Exact is specified.

Reeza
Super User
And you can use ODS SELECT/EXCLUDE to control the output if you don't want a specific table or such for a report.
varatt90
Obsidian | Level 7

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! 

ballardw
Super User

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 3265 views
  • 7 likes
  • 4 in conversation