Dear All, I found this question here (in Chinese). The data set is
Suppose that there is (at most) one merger and/or acquisition (MA, denoted by the `ma' variable) per `stkcd' across years. MA occurred in the year when "YES" appeared. I'd like to have the following two variables (in the MA year).
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long stkcd int year str4 ma float rd 8 2009 "#N/A" 0 8 2010 "#N/A" 0 8 2011 "#N/A" 0 8 2012 "#N/A" 0 8 2013 "#N/A" 0 8 2014 "#N/A" 0 8 2015 "#N/A" 0 8 2016 "YES" 7367428 8 2017 "#N/A" 17148702 8 2018 "#N/A" 7281274 8 2019 "#N/A" 10828121 9 2009 "#N/A" 2930650 9 2010 "#N/A" 3629185 9 2011 "#N/A" 5196702 9 2012 "#N/A" 5190145 9 2013 "#N/A" 3628819 9 2014 "#N/A" 5801677 9 2015 "YES" 10642266 9 2016 "#N/A" 15253602 9 2017 "#N/A" 18787858 9 2018 "#N/A" 24116868 9 2019 "#N/A" 24998574 end
- I'd like to calculate the mean of `rd' over three years before the MA year.
- I'd like to calculate the mean of `rd' over three years after the MA year.
Comment