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
Normalization of year interaction term to zero for interpretationDear all, I am working with a cross-sectional data set for the years 2005 to 2015. I am trying to e…
Predicting factors scores after CFAHello I am currently working on confirmatory factor analyses with my survey data using the command …
Ordered Logit coefficient interpretation with categorical (>2) independent variablesHi I am running an ologit model to understand the effect of parents' beliefs on students' high scho…
Doubts on autocorrelationDear Statalist users, I am kind of new with Stata and I'd really appreciate your help. I have been w…
Question about replace with multiple Criteria based on identifierHello friends. I have a dataset like this: ID Qualification Score A BS A Graduated A MS …
Subscribe to:
Post Comments (Atom)
0 Response to Issues with local macro
Post a Comment