0
votes

I am interested in using PROC FREQ to output many chi-square tests. However, I am wondering if I can set it so that SAS only prints p-values less than the a certain number.

For example, in the following I would only like to output the chi-square tests which have p-values less than 0.15.

proc freq data = data_set;
tables A*B A*C A*D A*E B*C B*D B*E C*D C*E D*E / chisq; 
run;
1
Watch out for errors because of multiple comparisons :)Andrew

1 Answers

1
votes

The only way I can think of is to output each result to a dataset (using ODS) and restrict the value from there.

ods output chisq(match_all)=want (where=(statistic='Chi-Square' and prob<0.15));
proc freq data = data_set;
tables A*B A*C A*D A*E B*C B*D B*E C*D C*E D*E / chisq; 
run;
ods output close;

chisq is the name of the element containing the chi squared value. The match_all option creates an incremental dataset (want, want1, want2 etc) for each test (otherwise only 1 dataset is created and is overwritten for each new test). You could then union these tables into 1 to see which tests have a p-value of less than 0.15.