How can Fisher’s exact test be performed in SAS? 2

How can Fisher’s exact test be performed in SAS?

Fisher’s exact test is a statistical method used to determine the significance of the relationship between two categorical variables. It is particularly useful when dealing with small sample sizes or when the assumptions of other statistical tests are not met.

In SAS, Fisher’s exact test can be performed by using the PROC FREQ procedure. This procedure allows the user to specify the variables of interest and the desired test statistic (e.g. two-sided or one-sided p-value). The output of the PROC FREQ procedure includes the test statistic, p-value, and confidence interval, which can be used to make conclusions about the relationship between the variables.

To perform Fisher’s exact test in SAS, the data must be organized in a contingency table format, with the categorical variables as rows and columns. It is important to ensure that the data is properly formatted and that all necessary assumptions are met before running the test. SAS also offers options to customize the test, such as specifying alternative hypotheses and adjusting for multiple comparisons.

In summary, Fisher’s exact test can be easily performed in SAS using the PROC FREQ procedure, providing a reliable and efficient method for evaluating relationships between categorical variables.

Perform Fisher’s Exact Test in SAS


is used to determine whether or not there is a significant association between two categorical variables.

It is typically used as an alternative to the when one or more of the cell counts in a 2×2 table is less than 5.

Fisher’s Exact Test uses the following null and alternative :

  • H0: (null hypothesis) The two variables are independent.
  • H1: (alternative hypothesis) The two variables are not independent.

If the of the test is less than a certain significance level, we can reject the null hypothesis of the test and conclude that the two variables are not independent, i.e. they have a significant association.

The following example shows how to perform Fisher’s Exact Test in SAS.

Example: Fisher’s Exact Test in SAS

Suppose we want to know whether or not gender is associated with political party preference at a particular college.

To explore this, we 25 students on campus and ask them about their political party preference. The results are shown in the table below:

 DemocratRepublican
Female84
Male49

To determine if there is a statistically significant association between gender and political party preference, we can use the following steps to perform Fisher’s Exact Test in SAS:

Step 1: Create the Data

First, let’s create a dataset called my_data:

/*create data to hold survey results*/
data my_data;
    input Party $ Gender $;
    datalines;
Rep Female
Rep Female
Rep Female
Rep Female
Rep Male
Rep Male
Rep Male
Rep Male
Rep Male
Rep Male
Rep Male
Rep Male
Rep Male
Dem Female
Dem Female
Dem Female
Dem Female
Dem Female
Dem Female
Dem Female
Dem Female
Dem Male
Dem Male
Dem Male
Dem Male
;
run;

Step 2: Perform Fisher’s Exact Test

Next, we can use the following code to perform Fisher’s Exact Test:

/*perform Fisher's Exact test*/
proc freq;
    tables Party*Gender / fisher;
run;

Fisher's exact test in SAS

The null hypothesis for Fisher’s Exact Test is that the two variables are independent. In this example, our null hypothesis is that gender and political party preference are independent, which is a two-sided test.

Thus, we’ll look at the two-sided p-value in the final table of the output, which turns out to be 0.1152.

Since this p-value is not less than 0.05, we do not reject the null hypothesis.

This means we do not have sufficient evidence to say that there is a significant association between gender and political party preference.

Additional Resources

The following tutorials provide additional information about Fisher’s Exact Test:

Cite this article

stats writer (2024). How can Fisher’s exact test be performed in SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-fishers-exact-test-be-performed-in-sas/

stats writer. "How can Fisher’s exact test be performed in SAS?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-can-fishers-exact-test-be-performed-in-sas/.

stats writer. "How can Fisher’s exact test be performed in SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-fishers-exact-test-be-performed-in-sas/.

stats writer (2024) 'How can Fisher’s exact test be performed in SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-fishers-exact-test-be-performed-in-sas/.

[1] stats writer, "How can Fisher’s exact test be performed in SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.

stats writer. How can Fisher’s exact test be performed in SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top