TVEM SAS Macro for Estimating a Time-Varying Effect Model

SAS TVEM Macro + Examples:
Users’ Guide: %TVEM SAS Macro Users’ Guide (Version 3.1.1)
TVEM Macro for ZIP outcomes:


For use with SAS Version 9.2 or higher for Windows.

The TVEM SAS macro estimates coefficients in a time-varying effect model. Traditional analytic methods assume that covariates have constant (i.e., time-invariant) effects on a time-varying outcome. The %TVEM macros are able to estimate the time-varying effects of covariates. TVEM is a convenient tool for several types of data.

4-minute video: How to run a SAS macro

Features of the TVEM SAS macro

  • Option to include multiple non-time-varying covariates
  • Option to include multiple time-varying covariates
  • Ability to accommodate of different distributions (normal, logistic, or Poisson) measured over time
  • Option to employ a penalized truncated power spline basis instead of a B-spline basis function
  • Ability to model within-subject correlation using random effects or a robust sandwich variance estimator New in version 3.1.0
  • Enhanced screen output for improved interpretability New in version 3.1.0
  • Multiple optional output datasets New in version 3.1.0

The %TVEM_zip for outcomes (v 2.1.1) is available separately to fit zero-inflated Poisson models.


Recommended Citations

TVEM SAS Macro (Version 3.1.1) [Software]. (2017). University Park: The Methodology Center, Penn State. Retrieved from

Li, R., Dziak, J. J., Tan, X., Huang, L., Wagner, A. T., & Yang, J. (2017). TVEM (time-varying effect model) SAS macro users’ guide (Version 3.1.1). University Park: The Methodology Center, Penn State. Retrieved from