@kweg wrote:
Thank you! This worked beautifully and was a huge time saver!
I merged the first two groups since they were both had lower counts to help reduce the frequency of cells <5. Now to review the results...
If you are familiar with Proc Freq syntax you could likely capture the output results you want by adding an OUTPUT statement and naming the output data set based on the ORG variable. Then perhaps append all of those and create an easier to read summary report.
Such as:
data _null_;
set have ;
by org;
if first.org then do;
call execute ('proc freq data=analysis;');
length str $100;
str = catx(' ','where org in (999',org,');');
call execute (str);
str = catx(' ','output out=',cats('work.chisq',org),'Pchi mhchi lrchi ;');
call execute (str);
call execute (' table group*org/chisq;
weight count;
run;');
end;
run;
data work.allchi;
length source $40.;
set work.chi: indsname=dsname;
source = dsname;
run;
The last data set combines all of the chi-square (or other statistics if the proper tables statement and stats are added to the OUTPUT statement) plus the source data set name. I might place the result in a more permanent library though.
... View more