In SAS, the chisq option is used on the tables statement to obtain the test statistic and its associated p-value. Using the mpg data file, let’s see if there is a relationship between the binary variable about the number of cylinders (cyl_six) and binary variable about drive type (drv_front). Remember that the chi-square test assumes that the expected value for each cell is five or higher. This assumption is easily met in the examples below. However, if this assumption is not met in your data, please see the section on Fisher’s exact test.
proc freq data = mpg; tables cyl_six * drv_front / chisq; run;
The contingency table shows there is no single cell has expected count less than 5, indicating Chi-square test is reliable here. The result also indicate that there is a statistically significant relationship (not independent) between the cylinder numbers (cyl_six) and drive type (drv_front) (chi-square with one degree of freedom = 41.1627, p = <.0001).