Similar to what we do in Chi-square test, the fisher option is used on the tables statement to obtain the test statistic and its associated p-value. The mpg data file was used and instead looking for the relationship between cyl_six and drv_front, the relationship between cyl and drv is what we interest in.
proc freq data = mpg; tables cyl * drv / fisher; run;
Since some of the cells have less than 5 expected count, Chi-square test may not have reliable result. The result of Fisher’s exact test suggest that there is a statistically significant relationship between cyl and drv (p = 6.816E-24).