Let’s use the mpg data file and create a new categorical variable according to exist variable drv. The new drv_front variable is defined as 1 if drv = ‘f’ or 0 if not equal ‘f’. We wish to test whether the proportion of front-wheel drive (drv_front) differs significantly from 50%. The exact statement to produce the exact p-values for binomial distribution.
data mpg; set mpg; if drv = 'f' then drv_front = 1; else drv_front = 0; run;
proc freq data = mpg; tables drv_front / binomial (p=.5); exact binomial; run;
The results indicate that there is no statistically significant difference (p = .1697). In other words, the proportion of front-wheel drive car in this sample does not significantly differ from the hypothesized value of 50%.