Dear statalist,
I have a set of data that spans over 2010-2019, there is a dummy, vf, that ==1 if the event vf happened in that year. vf can only happen once for each firm throughout the sample period.
What I want to do:
1. create 6 dummies, vf (already created), pre_vf_1, pre_vf_2, pre_vf_3, post_vf_1, post_vf_2, that ==1 in the year event vf happens, 1 year before vf happens, 2 years before, 3 years before, 1 year after, and 2 years after
2. create 2 dummies, with pre_vf ==1 if it is 1 to 3 years prior to the year event vf happens, and post_vf ==1 if it is the year event vf happens and 1-2 years after the year event vf happens, so basically categorise the 6 dummies in no.1 to 2 dummies (3 years pre vs current + 2 years post)
Some firms may not have 3 years prior to the event year. I have another variable, listingyear, which indicates the year the firm is listed (if the firm is not listed, then it won't be in my sample). If a firm is listed in 2012 and vf happens in 2013, then there is only 1 year in the pre-period. If that is the case, pre_vf_1 should be coded 1 while pre_vf_2 and pre_vf_3 should ==. as they do not exist. Whereas pre_vf is still coded 1 as it has a pre-period of 1 year in the 3-year pre-period. If another firm is listed in 2012 and vf also happens in 2012, then pre_vf_1, pre_vf_2, pre_vf_3, and pre_vf all should ==.
There is also concern that some firms may not have 2 years post to the event year. If the firm is delisted, I exclude the year of delisting and the years after delisting from the sample. Say a firm with vf happen in 2012 and it is delisted in 2014, then post_vf_1 should ==1, post_vf_2should ==. , and post_vf should ==1
I have data for other variables I needed to do regressions from 2007-2021, so if a firm with vf happens in 2010, pre_vf_1, pre_vf_2, and pre_vf_3 can be coded 1. If a firm with vf happens in 2019, post_vf_1 and post_vf_2 can be coded 1.
Here is some data
I hope this is not too confusing. Thanks for any suggestions
I have a set of data that spans over 2010-2019, there is a dummy, vf, that ==1 if the event vf happened in that year. vf can only happen once for each firm throughout the sample period.
What I want to do:
1. create 6 dummies, vf (already created), pre_vf_1, pre_vf_2, pre_vf_3, post_vf_1, post_vf_2, that ==1 in the year event vf happens, 1 year before vf happens, 2 years before, 3 years before, 1 year after, and 2 years after
2. create 2 dummies, with pre_vf ==1 if it is 1 to 3 years prior to the year event vf happens, and post_vf ==1 if it is the year event vf happens and 1-2 years after the year event vf happens, so basically categorise the 6 dummies in no.1 to 2 dummies (3 years pre vs current + 2 years post)
Some firms may not have 3 years prior to the event year. I have another variable, listingyear, which indicates the year the firm is listed (if the firm is not listed, then it won't be in my sample). If a firm is listed in 2012 and vf happens in 2013, then there is only 1 year in the pre-period. If that is the case, pre_vf_1 should be coded 1 while pre_vf_2 and pre_vf_3 should ==. as they do not exist. Whereas pre_vf is still coded 1 as it has a pre-period of 1 year in the 3-year pre-period. If another firm is listed in 2012 and vf also happens in 2012, then pre_vf_1, pre_vf_2, pre_vf_3, and pre_vf all should ==.
There is also concern that some firms may not have 2 years post to the event year. If the firm is delisted, I exclude the year of delisting and the years after delisting from the sample. Say a firm with vf happen in 2012 and it is delisted in 2014, then post_vf_1 should ==1, post_vf_2should ==. , and post_vf should ==1
I have data for other variables I needed to do regressions from 2007-2021, so if a firm with vf happens in 2010, pre_vf_1, pre_vf_2, and pre_vf_3 can be coded 1. If a firm with vf happens in 2019, post_vf_1 and post_vf_2 can be coded 1.
Here is some data
Code:
year firm listingyear vf 2010 881 1998 1 2011 881 1998 0 2012 881 1998 0 2013 881 1998 0 2014 881 1998 0 2015 881 1998 0 2016 881 1998 0 2017 881 1998 0 2018 881 1998 0 2019 881 1998 0 2010 2074 2006 0 2011 2074 2006 0 2012 2074 2006 0 2013 2074 2006 0 2014 2074 2006 0 2015 2074 2006 0 2016 2074 2006 0 2017 2074 2006 0 2018 2074 2006 1 2019 2074 2006 0 2011 2641 2011 1 2012 2641 2011 0 2013 2641 2011 0 2014 2641 2011 0 2015 2641 2011 0 2016 2641 2011 0 2017 2641 2011 0 2018 2641 2011 0 2019 2641 2011 0 2015 2772 2015 0 2016 2772 2015 0 2017 2772 2015 0 2018 2772 2015 0 2019 2772 2015 0 2015 2773 2015 0 2016 2773 2015 0 2017 2773 2015 0 2018 2773 2015 1 2019 2773 2015 0

Comment