BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
patrick5
Calcite | Level 5

I have a 3 x 2 comparison with expected frequencies low enough to make Fisher's exact preferred over chi-square.  I'm trying to figure out how to output the Fisher's exact p-values for the pairwise comparisons to feed into PROC MULTTEST.  I found and modified an example from SAS documentation that works for chi-square, but can't figure out how to make it work for Fisher's (see below).  I assume I need to replace anything that refers to chi-square in the first line, but can't seem to make it work.  The data are structured as one line per subject:

subjectID  species  examtype

12345      CANINE         1

12346      FELINE          2

12347      EQUINE         1

.... 

 

And the output I'm looking for looks like this (copied from running the below using chi-square in SAS 9.4):

multtest.JPG

 

ODS OUTPUT chisq(PERSIST)=chisq(WHERE=(statistic="Chi-Square") rename=(Prob=Raw_P));
      PROC FREQ DATA= six;
         WHERE species in ('CANINE', 'FELINE');
         TABLES examtype * species / FISHER;
		 RUN;
	  PROC FREQ DATA= six;
         WHERE species in ('CANINE', 'EQUINE');
         TABLES examtype * species / FISHER;
		 RUN;
      PROC FREQ DATA= six;
         WHERE species in ('FELINE', 'EQUINE');
         TABLES examtype * species / FISHER;
		 RUN;
ODS OUTPUT CLEAR;

      PROC PRINT NOOBS;
         VAR value raw_p;
         RUN;

      PROC MULTTEST PDATA=chisq BON;
	  RUN;

Thanks in advance for any help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @patrick5 and welcome to the SAS Support Communities!

 

The ODS output datasets for chi-square and Fisher's exact test are structured differently. This should work:

ods output fishersexact(persist)=fisher(where=(name1='XP2_FISH') rename=(nvalue1=raw_p));

Dataset fisher will not contain a variable value, so please delete this from your PROC PRINT step.

View solution in original post

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @patrick5 and welcome to the SAS Support Communities!

 

The ODS output datasets for chi-square and Fisher's exact test are structured differently. This should work:

ods output fishersexact(persist)=fisher(where=(name1='XP2_FISH') rename=(nvalue1=raw_p));

Dataset fisher will not contain a variable value, so please delete this from your PROC PRINT step.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 1 reply
  • 2923 views
  • 0 likes
  • 2 in conversation