University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home
 

SAS Helpful Hints

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);

Several styles of HTML output can be requested by defining a macro variable named "HtmlStyle" before calling the procedure:

%Let HtmlStyle=URbw1;

Available styles include: URbw1, URpp1, BarrettsBlue, Beige, Brick, Brown, D3D, Default, Minimal, NoFontDefault, Printer, RTF, Statdoc, Theme, FancyPrinter, SansPrinter, SasdocPrinter and SerifPrinter.

The HTML output may be directed to a file by defining a macro variable named "HtmlFile" before calling the procedure:

%Let HtmlFile=c:/test.html;

The size of the text in the HTML output may be changed by defining a macro variable named "HtmlSize" before calling the procedure:

%Let HtmlSize=-1; *or;
%Let HtmlSize=+1;

Output:

 

Please send your comments and suggestions about this web page to A. Watts (watts@bst.rochester.edu)