Hi my intervention period is both 2000 and 2001 in the difference-in-differences model. So I want to create a proper dummy variable for Post-intervention period.
In that case, I wonder how to assign no value to the year 2000 and 2001. In other words, I assign the value 0 for all the years before 2000 and 1 for all the years after 2001. Then in stata do file, how could I assign no value for those intervention years of 2000 and 2001.
Initially, I tried the following, but I am not sure if `NA` would be proper way to create the dummy for the DiD estimation.
In that case, I wonder how to assign no value to the year 2000 and 2001. In other words, I assign the value 0 for all the years before 2000 and 1 for all the years after 2001. Then in stata do file, how could I assign no value for those intervention years of 2000 and 2001.
Initially, I tried the following, but I am not sure if `NA` would be proper way to create the dummy for the DiD estimation.
Code:
gen post_intervention = 0 replace post_intervention = 1 if year > 2001 replace post_intervention = NA if year == 2000 & 2001
Comment