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.

1 Answer 1


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?


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)
  • $\begingroup$ 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? $\endgroup$ May 14 at 5:52
  • $\begingroup$ No problem. How do the other responses/suggestions on this forum differ from your model? $\endgroup$ May 14 at 6:14
  • $\begingroup$ 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. $\endgroup$ 2 days ago
  • $\begingroup$ 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! $\endgroup$ 2 days ago
  • $\begingroup$ Apologies for so many comments, I've created a new post where I've put down all the information -> stats.stackexchange.com/questions/575545/… $\endgroup$ 2 days ago

Your Answer

Santi Beans is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.