University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home

SAS Helpful Hints

Biostat Macro Library

Percent Change

%PctChange and %PctPrint reside in the departments SAS Macro Library and are enabled with the following SAS statements:

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

For safety we like to run Chi-Square tests on the number of subjects that have a 20% change from baseline. The procedure %PctChange does this for a list of outcome measures. 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). If you would like to check for other %changes besides 20, you can define a macro variable "percents" as a list of percentages to use. There must be one percentage for each outcome measure in the procedure call:

%Let percents=10 10 5 5;

%PctPrint creates a listing of subjects that have a 20% change from baseline on the listed outcome measures. This procedure is very helpful in identifying subjects with radical changes over time.

Syntax:
%PctChange
(dataset,who,group,visit,baseline,request,percnts,varlist);
%PctPrint
(dataset,who,group,visit,baseline,varlist);  
    dataset:    Dataset to use.
    who:        Subject ID.
    group:      Treatment group.
    visit:         Time variable: visit, week, month...
    baseline:   Baseline visit.
    request:    All(All combinations), Dosage(Each against first), Twobytwo(2x2 design).
    percents:  (Y/N) Print group percents.  
    varlist:      List of variables to Tabulate.

Example:
%PctChange(work.A,id,treatment,week,0,Dosage,Y,A B C D);
%PctPrint(work.A,id,treatment,week,0,A B C D);

The default number of significant digits, two, can be changed by defining a macro variable named “Digits” before calling the procedure:

%Let Digits=1;

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)