Dear community members
How can I create an indicator variable (random) by sorting firms randomly and assigning the first X # of firms to treatment based on how many actual X # firms are treated that year? the indicator will be used in placebo test to ensure the results of my staggered Here is an example of my data: note that magnitude is my DV and treatedxmandate is my IV, and policy in effect indicates the year in which the mandate is passed. Thanks for your kind input.
input float(magnitude treatedxmandate) into Year float(country_id firm_id policy_in_effect)
0 0 2009 15 1101 0
0 0 2014 32 2431 0
0 0 2009 45 297 0
0 0 2008 45 297 0
0 0 2010 45 297 0
0 0 2016 50 2872 0
0 0 2015 50 2872 0
0 0 2017 50 2872 0
0 0 2019 50 2872 0
0 0 2016 50 2868 0
0 0 2016 2 9 0
0 0 2017 2 9 0
0 0 2012 37 2530 0
0 0 2013 37 2530 0
0 0 2016 45 295 0
0 0 2013 3 39 0
0 0 2015 3 39 0
0 0 2017 50 3275 0
0 0 2018 45 295 0
0 0 2011 42 1875 0
0 0 2006 49 919 0
0 0 2010 42 1875 0
How can I create an indicator variable (random) by sorting firms randomly and assigning the first X # of firms to treatment based on how many actual X # firms are treated that year? the indicator will be used in placebo test to ensure the results of my staggered Here is an example of my data: note that magnitude is my DV and treatedxmandate is my IV, and policy in effect indicates the year in which the mandate is passed. Thanks for your kind input.
input float(magnitude treatedxmandate) into Year float(country_id firm_id policy_in_effect)
0 0 2009 15 1101 0
0 0 2014 32 2431 0
0 0 2009 45 297 0
0 0 2008 45 297 0
0 0 2010 45 297 0
0 0 2016 50 2872 0
0 0 2015 50 2872 0
0 0 2017 50 2872 0
0 0 2019 50 2872 0
0 0 2016 50 2868 0
0 0 2016 2 9 0
0 0 2017 2 9 0
0 0 2012 37 2530 0
0 0 2013 37 2530 0
0 0 2016 45 295 0
0 0 2013 3 39 0
0 0 2015 3 39 0
0 0 2017 50 3275 0
0 0 2018 45 295 0
0 0 2011 42 1875 0
0 0 2006 49 919 0
0 0 2010 42 1875 0
Comment