# How to Apply Fishers Exact Test in SAS Using PROC FREQ Procedure

Interactive Online Courses: Elevate Skills & Succeed Enroll Now!

We looked at t-tests, correlation, and regression, Bland-Altman analysis, chi-square test in the previous tutorials, today we will be looking at another process called SAS Fishers Exact test and how they can be created in SAS Programming Language with using PROC FREQ Procedure.

We will also study Fisher exact test SAS Syntax and also get Proc Freq fisher exact test output.

## What is SAS Fishers Exact Test

The Fisher Exact test in SAS is a test of significance that is used in the place of chi-square test SAS in 2 by 2 tables, especially in cases of small samples.

If the assumptions for using the chi-square test are not met (i.e., small expected numbers in one or more cells), then an alternative hypothesis test to use is Fisher exact test.

This non-parametric test assumes that the row and column totals are fixed and considers the possible distributions of data values within the table.

## The PROC FREQ Procedure

We saw the use of PROC FREQ, to create frequency distribution tables, and to create chi-square tests, but it can also be used to create a SAS Fisher exact test.

A Syntax of PROC FREQ Procedure-

```PROC FREQ DATA = dataset;
TABLES Variable1*Variable2 / fisher;```

Here the syntax looks similar to the one we used for cross tabulation except for the fisher option that gives us a fisher exact test result.

## Applying Fishers Exact Test in SAS

SAS Fishers Exact Test is a very simple test, in the example below, we choose two categorical variables a1 and a2 and apply test on them using Proc Freq.

Example of SAS Fishers Exact Test-

```data new;
input  a1 a2 Result @@;
datalines;
2 3 4 4 1 1 2  7 5 6 7;
proc freq;
tables a1*a2 / fisher;
run;```

Fishers Exact Test in SAS Using PROC FREQ Procedure

Output – SAS Fisher Exact Test

## Conclusion

Hence, we hope you all understood what is SAS Fishers exact test and how can we create Fishers exact test in SAS Programming Language.

In conclusion, we saw PROC FREQ Procedure. Furthermore, if you have any query feel free to ask in a comment section and stay tuned to learn more interesting things in SAS.

Your 15 seconds will encourage us to work even harder

DataFlair Team

The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.

### 3 Responses

1. Turner says:

Wow this is worthless. I understand what fisher’s exact is. I have know idea how to read the output from SAS. which of the two lines pertains to the null hypothesis?

2. jolie says:

very worthless I agree

3. dee says:

Fisher is for a 2×2 table only. You give an example with a 4×4 table. Is Fisher’s exact test valid for a 4×4 comparison?