# Adding Controls to Staggered Difference in Difference Regressions on Stata

I am running a staggered diff-in-diff model, looking at legalization's effect on various variables. For context, only a percentage of all states have legalized, and the year they legalized differs across those states, hence the staggered approach. I am looking at the treatment (legalization)'s effect on variables (in this case, TotRev).

I've seen other threads suggest the construction of a 'treatment' dummy which is switched on for all years for states which legalized (no matter the year they legalize), as well as an 'active treatment' dummy which is switched on only for the years and states in which legalization is active (and off for all else, including legalized states pre-legalization).

New contributor
Santi Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

I am wondering if this is fine, or do I need to interact i.treatment and i.activetreatment, so that it forms i.treatment#i.activetreatment?

No.

The variable activetreatment will work just fine. The variable should 'turn on' (i.e., switch from 0 to 1) in any state and year combination where legalization was active, 0 otherwise. In states where legalization did not occur, activetreatment is 0 in all time periods. We must define treatment in this way, as different states enact legislation in different years. Again, since we have no well-defined period where treatment starts, then the policy variable is just 'switching on' in any state-year observation where the policy is active, 0 otherwise.

Also, you can safely omit treatment as it's collinear with the state fixed effects. You're not really penalized for including a time-constant input variable; software will drop it from the model output.

I was also confused about adding control variables. Say I wanted to control for salary per capita, would I add the variable as TotSalariespc or i.TotSalariespc?

Assuming it's a continuous, time-varying covariate, then it's permissible to include it. I recommend specifying the salary variable unprefixed.

Also, am I placing the control variable in the right place?

It is specified to the right of your outcome variable like a typical covariate. I found it difficult to parse through your code since it was written in the text of your question, but this should work:

xtset state year
xtreg totrev i.activetreatment totsalariespc i.year, fe cluster(state)

• Brilliant thank you for your answers, they are a lot of help! I was also wondering how I would go about including include lags (to check whether the effect increases or decreases over time) and leads (to check for parallel trends). I’ve tried to look it up, but all the examples I found differed from the model I’m using, so I wasn’t too sure. Am I right in saying that I have to quantify the years before and after treatment, e.g. treatment would be year 0, 3 years pre-treatment would be -3, 5 year post-treatment would be 5? May 14 at 5:52
• No problem. How do the other responses/suggestions on this forum differ from your model? May 14 at 6:14
• Hi Thomas, apologies for the delayed response, I haven't had access to my computer until now. All the other posts I've seen describe the concepts behind creating lags and leads, so I know that the control group's time dummies should be 0, and standardise the time dimension from the most extreme lag to most extreme lead. I understand all this, but I am not sure how I would set it up in Stata. I'm trying to code lags and leads: 1) lags to check whether the effect increases or decreases over time, and 2) leads to check for parallel trends. 2 days ago
• Continuing -> I have yet to find any other post that describes how this could be done in Stata, so I would be really grateful if you could perhaps link a relevant post or maybe explain how I would go about tackling this! 2 days ago
• Apologies for so many comments, I've created a new post where I've put down all the information -> stats.stackexchange.com/questions/575545/… 2 days ago