I have a quick question about making treated column after policy effective date
There is effective date of the certain policies for certain counties.
I would like to change the whole date as the policy treated date of certain counties after the effective date.
For example, the policy start date of 1001 county is Nov. 2008. And I want to change whole “policy applied“ column as 1 after Nov. 2008 like below.
But, I only have “currently” column after merging with policy date file.
County | Year | Month | Currently | Policy applied |
1001 | 2008 | 10 | 0 | 0 |
1001 | 2008 | 11 | 1 | 1 |
1001 | 2008 | 12 | 0 | 1 |
1001 | 2009 | 1 | 0 | 1 |
1001 | 2009 | 2 | 0 | 1 |
… | ||||
… | ||||
… | ||||
1001 | 2014 | 10 | 0 | 1 |
1001 | 2014 | 11 | 0 | 1 |
1001 | 2014 | 12 | 0 | 1 |
g tm=ym(year,month)
gen lastdate = 659 // Dec. 2014
order tm lastdate Currently
gen difference = lastdate-tm
bys county year month: egen effective=max(Currently) if Currently ==1
replace effective=1 if difference~=0
I know the last coding was incorrect…because that will make all the past months “0”.
Please give some idea of how to change the policy applied column from 0 to 1 after the effective date.
Hope this question makes sense.
Thank you for your help in advance.
0 Response to How to create treated column after policy effective date
Post a Comment