Hi everyone,
I have a panel data (1960 to 1980) with multiple locations (lgacodes) and am trying to create a column with the first year of treatment for each location (to do Difference-in-Differences with multiple periods). I used this code:
bysort lgacodes: replace first_treat=min( year1_lga) if dummy_general==1
but it didn't work, so I used:
bysort lgacodes: replace first_treat= year1_lga if dummy_general==1
instead.
Now, I believe I have to create a foreach loop to replace 'first_treat' with the min (year1_lga) for each lgacodes, but not sure how to do it. Could you please help?
Many thanks,
Here is a sample of my data Array
Related Posts with Create a first.treat for DID with multiple periods
ComandesHello, I’m trying to use the PISA dataset but I’m not being able convert it from SAS and SPSS. It i…
How to get conditional maximum dates and values?Hi all, I would like to find the largest % of institutional ownership for each deal, for example, f…
Utilizar SPSSHello, I’m trying to use the PISA dataset but I’m not being able convert it from SAS and SPSS. It i…
unbalanced panel data with endogenous explanatory variable and some unobservable variablesHi All, I'm struggling with an equation that has an endogenous regressor (sample selection bias) and…
Stacked bar graph: percentage of total observations, by groupsHello, I would like to produce a graph that shows the percentage of total observations (code_7), ov…
Subscribe to:
Post Comments (Atom)
0 Response to Create a first.treat for DID with multiple periods
Post a Comment