**********************************************************
* Program Name: Calculating SMR and IPTW in SAS
* Original date: April 14 2019
* Author: Bailey DeBarmore
* Software: Stata
* Downloaded from www.baileydebarmore.com/epicode
**********************************************************;
******************************************
* Calculating SMR weights
*****************************************;
* Syntax for teffects statement
*teffects ipw () ( ), atet
*where is your outcome variable, is your exposure variable, and
* is a list of your covariates to generate your weights.
*Example: Binary
*Outcome = lowbirthwt
*Exposure = maternalsmoke
*Covariates = maternalage nonwhite
*Use the teffects statement to generate your weights and then apply them in a logistic (default) model all in 1 step
teffects ipw (lowbirthwt) (maternalsmoke maternalage nonwhite), atet
*If your outcome is continuous, you can specify a probit model
*Example: Continuous
*Outcome = birthwt
*Exposure = maternalsmoke
*Covariates = maternalage nonwhite
teffects ipw (birthwt) (maternalsmoke maternalage nonwhite, probit), atet
******************************************
* Calculating IPTW
*****************************************;
* Syntax for teffects statement
*teffects ipw () ( ), ate
*where is your outcome variable, is your exposure variable, and
* is a list of your covariates to generate your weights.
*Example: Binary
*Outcome = lowbirthwt
*Exposure = maternalsmoke
*Covariates = maternalage nonwhite
*Use the teffects statement to generate your weights and then apply them in a logistic (default) model all in 1 step
teffects ipw (lowbirthwt) (maternalsmoke maternalage nonwhite), ate
*If your outcome is continuous, you can specify a probit model
*Example: Continuous
*Outcome = birthwt
*Exposure = maternalsmoke
*Covariates = maternalage nonwhite
teffects ipw (birthwt) (maternalsmoke maternalage nonwhite, probit), ate