Back to main page

So, you use WinBUGS a lot? Want more?
Patrick Blisle
Division of Clinical Epidemiology
McGill University Health Center
Montreal, Quebec CANADA

Last modification: 11 oct 2016

SAS macros
SAS macros are very useful, for example, to repeat similar analyses with different data sets, outcome variables, explanatory variables, etc. This page is not the place to learn macro programming; rather, I hereafter make public a few macros that I have written through the years and that have shown to be useful to colleagues. Help yourself if you find any of them interesting too!

Macro Object
%AickinAlpha Aickin Alpha agreement coefficient
%BICOrdinalLogistic Compute Bayesian Information Criterion (BIC) in Ordinal Logistic Regression Models
%BICSurvTimeDependent Compute Bayesian Information Criterion (BIC) in Survival Models when one or more of the independent variables is (are) time-dependent
%DatesDesc Descriptive statistics for date variables
%mds2wb Exporting multi-dimensional data (sas→WinBUGS)
%MeanOf Computing the arithmetic mean of several variables in proc sql
%MultiTranspose Transposing multiple variables in a SAS data set within a single macro call
%NewDatasetName Get a new (unused) data set name
%NOf Computing the number of non-missing values in a series of variables in proc sql
%ProportionsDiffCIsNewcombe Computing confidence intervals for difference between independent proportions
%SumOf Computing the sum of several variables in proc sql
%VennDiagram Plot a 3-way Venn diagram

If you would like to start writing your own macros, I'd suggest you to read the interesting document Tips on writing sas macros written by Roland Berry.