Hi all,
I'm replicating a Donald & Lang (2007)-style 2-step difference-in-differences approach using Stata with svy:. In Step 1, I regress an outcome (maternity_leave) on an interacted treatment-by-year set of dummies using:
svy: reg outcome i.year i.treat#i.year controls, nocons
I want to extract only the coefficients of the treat#year and combine them with the summed person weights (asecwt) by year to prepare a dataset for Step 2 including: year, coefficients (pi_vector), and summed weights. Years included are 2015-2024 (10 coefficients to extract).
I've tried using matrix b = e(b) followed by svmat, but I ran into errors because of the structure of e(b). I'd like a simple and reproducible way to:
Thanks in advance!
I'm replicating a Donald & Lang (2007)-style 2-step difference-in-differences approach using Stata with svy:. In Step 1, I regress an outcome (maternity_leave) on an interacted treatment-by-year set of dummies using:
svy: reg outcome i.year i.treat#i.year controls, nocons
I want to extract only the coefficients of the treat#year and combine them with the summed person weights (asecwt) by year to prepare a dataset for Step 2 including: year, coefficients (pi_vector), and summed weights. Years included are 2015-2024 (10 coefficients to extract).
I've tried using matrix b = e(b) followed by svmat, but I ran into errors because of the structure of e(b). I'd like a simple and reproducible way to:
- Pull out the treat#year πₜ coefficients
- Match them to a year variable
- Add summed weights by year
Thanks in advance!
Comment