Your example data doesn't include anything from the treated group. So this code is not fully tested:
Some thoughts:
1. I'm not sure how useful linear trend lines are in this context. The pre-intervention data in your example don't look very linear with time. Something special seems to be going on around 2016.
2. The post-treatment data have no relevance to the parallel trends assumption. I have included them in the scatter plot, but not in the trends.
3. You may need to play around with some options to get the legend into a more useful form.
Code:
collapse (mean) sdresidual1, by(treated datacqtr) reshape wide sdresidual1, i(datacqtr) j(treated) label var sdresidual10 "Control" label var sdresidual11 "Treatment" local iquarter = tq(2018q1) // INTERVENTION TIME graph twoway (scatter sdresidual* datacqtr, xline(`iquarter')) /// (lfit sdresidual10 datacqtr if datacqtr < `iquarter') /// ((lfit sdresidual11 datacqtr if datacqtr < `iquarter'))
1. I'm not sure how useful linear trend lines are in this context. The pre-intervention data in your example don't look very linear with time. Something special seems to be going on around 2016.
2. The post-treatment data have no relevance to the parallel trends assumption. I have included them in the scatter plot, but not in the trends.
3. You may need to play around with some options to get the legend into a more useful form.
Comment