PROC FREQ computes frequency counts and a chi-square analysis on variables X and Y in data set TEST. This output is routed to the file referenced as ROUTED.
proc freq data=test; tables x*y / chisq; run;