SAS Macros
Here are several macros written by Paul Allison to perform various useful tasks in SAS. If you don’t know how to use a SAS macro, click here to view a video produced by the the Methodology Center at Penn State.
Here are several macros written by Paul Allison to perform various useful tasks in SAS. If you don’t know how to use a SAS macro, click here to view a video produced by the the Methodology Center at Penn State.
PREDICT_LDM
MACRO PREDICT_LDM produces a data set containing predicted values for a
linear probability model that are never less than 0 or greater than 1.
It is an implementation of the method described in my blog post at
https://statisticalhorizons.com/betterpredictedprobabilities
Download file »
COMBCHI
This macro takes chisquare statistics from multiple imputed data sets and combines them to produce a single pvalue.
Download file »
COMBINE
COMBINE takes estimates based on multiply imputed data sets and combines them into a single set of estimates and associated statistics. (Note: This macro has been largely superseded by PROC MIANALYZE).
Download file »
GLOGIT
GLOGIT does maximum likelihood estimation of logistic regression models for two or more groups when the residual variance is allowed to differ across groups.
Download file »
LIFEHAZ
This macro plots the hazard function for a model fitted by PROC LIFEREG. This version works for Release 6.12 through Release 9.2 of SAS
Download file »
MISS
MISS uses the EM algorithm to estimate the parameters of a multivariate normal distribution when data are missing, and optionally generates multiply imputed data sets using the methods of J. L. Schafer, "Analysis of Incomplete Multivariate Data." (Note: This macro has been largely superseded by PROC MI which accomplishes the same tasks, but is much faster).
Download file »
PREDICT
This macro calculates survival probabilities for models fitted by PROC LIFEREG. This version works for Release 8.2 of SAS and later.
Download file »
SMOOTH
(Updated 29 August 2014). MACRO SMOOTH produces graphs of smoothed hazard functions using output from either PROC LIFETEST or PROC PHREG. With LIFETEST, it uses the data set produced by the OUTSURV option on the PROC statement. (Note that smoothing capabilities are now built into PROC LIFETEST). With PHREG, it uses the data set produced by the BASELINE statement. SMOOTH employs a kernel smoothing method described by H. RamlauHansen(1983), "Smoothing Counting Process Intensities by Means of Kernel Functions," The Annals of Statistics 11, 453466. If either PROC contains a STRATA statement, SMOOTH will produce multiple smoothed hazard curves on the same axes. This update works for SAS 9.3 and 9.4. It requires ODS graphics to produce the graphs.
Download file »
Andrew Hayes 

Kristopher Preacher 

Stephen Vaisey 