University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home

SAS Helpful Hints

Biostat Macro Library

The procedures in the departments SAS Macro Library are enabled with the following SAS statements:

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

To create a character string "mean(std)" from two numeric variables:
%FixMeanStd
(mean,std,ms); * Create a character “mean(std)” from mean and std;
Options: %Let Digits=1-9; * To specify number if digits after the decimal;

To create a character string "N(%)" from two numeric variables:
%FixNPct(n,pct,np); * Create a character “N(%)” from n and pct;
Options: %Let Digits=1-9; * To specify number if digits after the decimal;

To open a Html output file:
%Let HtmlStyle=URbw1;
%HtmlOpen
;

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

To close the Html output file:
%HtmlClose;

To count the number of items in a list:
%Let n=%NItems(list);

To find the number of treatment groups in a dataset:
%CountGroups(dataset,group);
This procedure creates three global macro variables: NGroups, GMin, Gmax.

To replay several graphs on a single page from catalogue work.mplot:
%ReplayAll(PerPage,NGraphs);

To replay specific graphs from catalogue work.mplot, 2 on a page:
%Replay2(g1,g2);

To replay specific graphs from catalogue work.mplot, 3 on a page:
%Replay3(g1,g2,g3);

To replay specific graphs from catalogue work.mplot, 4 on a page:
%Replay4(g1,g2,g3,g4);

To replay specific graphs from catalogue work.mplot, 6 on a page:
%Replay6(g1,g2,g3,g4,g5,g6);

To replay specific graphs from catalogue work.mplot, 9 on a page:
%Replay9(g1,g2,g3,g4,g5,g6,g7,g8,g9);

To replay specific graphs from catalogue work.mplot, 16 on a page:
%Replay16(g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11,g12,g13,g14,g15,g16);

 

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