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
-cem- and treated vs untreatedHello stata-users, When using -cem- matching approach, I get 3 variables cem_strata, cem_matched, an…
update value of localHi, Suppose, you have a local, which depends on a second local. However, when the first local is de…
Duplicating a long IDDear Statalisters, I am working on a panel data set to uniquely identify respondents across time. I…
Coefficient Matrix in Unconditional Quantile RegressionsI am running models with the ivqte command, which estimates unconditional quantile regressions, as d…
t(100) specificationI have received the following request from one of our clients: PDF codebooks Please use the t(100)…
Subscribe to:
Post Comments (Atom)
0 Response to Issues with local macro
Post a Comment