Dear all,
I'm doing a staggered DID where the firms receive treatment in different years. My sample period is 2010-2019, and a firm could receive treatment in any one of the years (a firm would only be treated once in the sample period). I want to draw a graph to compare the mean of treatment and control groups, I have searched on stata and saw some relevant posts, such as https://www.statalist.org/forums/for...nce-estimation and https://www.statalist.org/forums/for...end-assumption. However, in their posts, it seems firms are treated in a single year, there is a clear absolute year, such as 1945 in the first link. In my context, I need relative years. I have created some relative year dummies
However, I don't know how to make it a single variable, say call it relative_year, and put it in the two way plot, the code would be something like this
where ind_adj_subsidy is my outcome variable, treat indicates whether the firm is being treated, year is in absolute years (e.g. 2010, 2011...). I would like year to be substituted with relative_year, how can I do this? What I'm most confused about is, control firms are not treated, so they don't have eventyear, then I cannot calculate distance = Year - eventyear, so I cannot have relative year dummies for control firms. How to solve this problem?
Thanks a lot in advance.
I'm doing a staggered DID where the firms receive treatment in different years. My sample period is 2010-2019, and a firm could receive treatment in any one of the years (a firm would only be treated once in the sample period). I want to draw a graph to compare the mean of treatment and control groups, I have searched on stata and saw some relevant posts, such as https://www.statalist.org/forums/for...nce-estimation and https://www.statalist.org/forums/for...end-assumption. However, in their posts, it seems firms are treated in a single year, there is a clear absolute year, such as 1945 in the first link. In my context, I need relative years. I have created some relative year dummies
Code:
gen distance = Year - eventyear
tab distance, missing
replace distance = -3 if distance < -3
replace distance = 2 if distance > 2
***generate year -3 -2 -1
forvalues i=3(-1)1{
gen d_`i'=(distance==-`i')
}
***generate year 1 2
forvalues i=1(1)2{
gen d`i'=(distance==`i')
}
***generate year 0
gen d0=(distance==0)
Code:
collapse (mean) ind_adj_subsidy, by (treat year) reshape wide ind_adj_subsidy, i(year) j(treat) graph twoway connected ind_adj_subsidy0 ind_adj_subsidy1 year, sort
Thanks a lot in advance.
