Hello,
I'm running a diff-in-diff using a policy with three phases of treatment. There's the issue of staggered treatment, but I still want to see the results of the separate phases.
Suppose I have two cohorts 0 and 1 which I use as the "before-after" of the diff-in-diff. The states that were treated in phases 1, 2 and 3 were (A, B, C), (D, E, F) and (G, H, I) respectively. I want to run a diff-in-diff for each phase by dropping the treated states in the other phases. E.g. for phase 1, I drop (D, E, F) and (G, H, I) and compare (A, B, C) to the control/remaining states. Since I'll have to do this for each phase and a bunch of outcome variables, I thought using local macros and running a loop over them would be useful.
My code looks like this:
use Data, clear
local all_trt_states " "A" "B" "C" " " "D" "E" "F" " " "G" "H" "I" "
foreach s of local all_trt_states {
local curr_trt_states " `s' "
local drp_trt_states: list all_trt_states - curr_trt_states
foreach d of local drp_trt_states {
drop if state==" `d' "
}
gen trt_p1=0
foreach s1 in " `s' " {
replace trt_p1=1 if state==" `s1' "
}
reg outcome i.trt_p1##i.cohort
}
The following line is giving me an error (invalid syntax):
local curr_trt_states " `s' "
What am I doing wrong here?
Thank you in advance.
Best,
Amrita Sanyal.
Related Posts with Issues with local macro
Travel cost method combining RP and SPHi I have a dataset with info on #trips for each individual (a total of 200) to a particular recreat…
using not allowed stata imputation hotdeckvarHi, I have a problem with my imputing syntaxs. hotdeckvar pasajeros1 using p, store by(marca clase2…
How to adjust restricted cubic spline curve for custom references?Hi, I am currently learning on how to conduct a dose-response meta-analysis. Following estimations …
Lo-Mackinlay variance ratio testHi everyone, I am using the Lomackinlay command to test for predictability in stock index returns (…
Determine the appropriate lag of independent variable panel data fixed effect modelHi, I am doing a fixed effect panel data regression (T=40 N=1087). Theoretically my independent va…
Subscribe to:
Post Comments (Atom)
0 Response to Issues with local macro
Post a Comment