SAS® meta-analysis macros


Beware of geeks when they come bearing gifts Guernsey McPearson


These macros are provided free. No guarantee is provided for their correct functioning and no liability is accepted for their use. These macros may be used freely, however, all responsibilities regarding validation / code integrity resides with the users – no responsibility is or will be borne by the collaborators or their respective academic/commercial companies. The macros are thus provided as is without any guarantees or warranty.

Fair Use

You may use these macros for your own purposes but if you use them as the basis for creating other macros you should be prepared to share and not copyright any code that incorporates them.


Macros written by Jim Weir based on Mathcad® programs by Stephen Senn with input by Tsushung Hua, Conny Berlin, Michael Branson and Ekkehard Glimm.


Very helpful code by Dorothy E Pugh has been incorporated in the macros used for plotting. See

Jim Weir and Stephen Senn are grateful to Novartis for providing funding for developing the macros.

Article describing these macros

A paper describing these macros was published online on 3 April 2011 in Statistics & Probability Letters.

Acknowledging the macros

If you use these macros, please acknowledge their source. Thank you.

The macros

Macro DescriptionLink
mabinary To carry out various approaches to analysing binary data including classic Mantel-Haenszel analysis but also, for example, the analysis of Normal-binomial mixtures using PROC NLMIXED®.
maforest To produce so-called forest plots whereby individual trials are represented by horizontal lines joining lower and upper confidence limits with a plotting symbol for the estimate and a final line and symbol for the overall meta-analytic
mafunnel To produce funnel plots. These plot the treatment estimate on the horizontal axis and the reciprocal of the standard error of the treatment estimate on the vertical axis.
magalbraith To produce radial or Galbraith plots as described in Statistics in Medicine, 1988.7,889-894. These plot the Z-scores, that is to say the ratio of estimated treatment effect to standard error, against the reciprocal of the standard error, where the latter is calculated as for a fixed effects analysis.
mainverse To carry out classic fixed effects meta-analysis using inverse weighting by variances of treatment contrasts.
mapeterlee To implement Lee’s checks as described in Statistics in Medicine,1999,18,1973-1981.
maqq To produce QQ plots of estimated treatment effects by trial.
marandom To carry out random effects analysis using the approach of DerSimonian and Laird (DSL), Controlled Clinical Trials, 1986,7,177-188 and also using that of Hardy and Thompson(HT), Statistics in Medicine, 1996,15, 619-629.
masensitivity To examine the sensitivity of conclusions from random effects analysis to the magnitude of the random effects variance.

Sample program

Sample program that can be used to run the macros.

Diagram explaining how the macros interact


Any comments? Please contact Stephen Senn


Go to Stephen Senn's pharmaceutical statistics links
Go to Stephen Senn's homepage

Update date

This page last updated 23 February 2012