My data is for years 2008 to 2021, and the first treated units appear in 2009. This is an example of how I would like the data to look for one unit when the unit was treated in 2013 and one that was never treated:
unit | year | treatment | firsttreat |
1 | 2008 | 0 | 2013 |
1 | 2009 | 0 | 2013 |
1 | 2010 | 0 | 2013 |
1 | 2011 | 0 | 2013 |
1 | 2012 | 0 | 2013 |
1 | 2013 | 1 | 2013 |
1 | 2014 | 1 | 2013 |
1 | 2015 | 1 | 2013 |
1 | 2016 | 1 | 2013 |
1 | 2017 | 1 | 2013 |
1 | 2018 | 1 | 2013 |
1 | 2019 | 1 | 2013 |
1 | 2020 | 1 | 2013 |
1 | 2021 | 1 | 2013 |
2 | 2012 | 0 | . |
2 | 2013 | 0 | . |
2 | 2014 | 0 | . |
2 | 2015 | 0 | . |
2 | 2016 | 0 | . |
2 | 2017 | 0 | . |
2 | 2018 | 0 | . |
2 | 2019 | 0 | . |
2 | 2020 | 0 | . |
2 | 2021 | 0 | . |
I am honestly at a complete loss as to how I could go about this. I would very much appreciate any help.
0 Response to Create a variable that indicates when unit was first treated with panel data
Post a Comment