Biostat Macro Library

Mass Production of Chi-Square Tests

%GroupSize and %Chisq reside in the departments SAS Macro Library and are enabled with the following SAS statements:

Libname biostat '\\BIO2\example\SASMacrosWindows';
Options Mstored SasMstore=biostat;

%GroupSize and %Chisq work together to count the number of events by treatment group, and calculate Chi-square tests between the groups. %GroupSize must be called first to set up some global macro variables that hold the size of each treatment group. The dataset passed to %GroupSize must have only one observation per subject. The dataset passed to %Chisq must have one observation for each event reported. Three batteries of Chi-square test may be done: All combinations(A-B,A-C,A-D,B-C,B-D,C-D), Dosage response(A-B,A-C,A-D), or TwoByTwo design(AB-CD,AC-BD,AD-BC). Chi-square test are done on the number of subjects experiencing events, not the number of events reported. (If a subject reports “headache” four times, it is only counted once.) The percent experiencing in each group may be suppressed from the report to save space.

Syntax:
%GroupSize
(datasetA,group);
    datasetA:  Dataset of enrolled with treatment group(one observation per subject).
    group:       Treatment group.

%Chisq(datasetB,who,by,group,request,percents);
    datasetB:  Dataset of events(one observation for each event).
    who:         Subject ID.
    by:            By list(AE, Labtest...).
    group:       Treatment group.
    request:     All(All combinations), Dosage(Each against first), Twobytwo(2x2 design).
    percents:   (Y/N) Print group percents.

Example:
%GroupSize(work.subjects,treatment);
%Chisq(work.aes,id,AE Severity,treatment,Twobytwo,Y);

Output: