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
Obtaining the standardized coefficients to a regression table using Outreg2.I have a simple regression that I would want to report standardized coefficients too. I run; Code:…
Extracting part of a string variableHi. I have a string variable that comprises of multiple words with no fixed order/that is not the sa…
outreg2 working for one but not another modelHi, I am using outreg 2 for exporting results. It is giving me the desired excel file in these case…
Keep with joint conditionHi I have another issue in relation to keeping variables with a joint condition. I am trying to sele…
outreg2 working for one but not another modelHi, I am using outreg 2 for exporting results. It is giving me the desired excel file in these case…
Subscribe to:
Post Comments (Atom)
0 Response to Create a first.treat for DID with multiple periods
Post a Comment