Hi everyone, I am currently working with M&A-data and I came across a challenge. I have constructed variables that show the years (2 before and 2 after the deal took place). I need to add the value of Revenuegrowth i.e. 2017 if the deal took place in 2016, to the new variable (still to be made): Revenuegrowth1year. So far I have this dataset:
Code:
                       * Example generated by -dataex-. To install: ssc install dataex
                        clear
                        input int(DealDate year year1beforedeal year2beforedeal year1afterdeal year2afterdeal) float(Revenueg2019 Revenueg2018 Revenueg2017)
                        19555 2013 2012 2011 2014 2015            .           .           .
                            .    .    .    .    .    .  -.019197315  .035000157    .0514132
                        21900 2019 2018 2017 2020 2021            .           .           .
                            .    .    .    .    .    .   -.10102984 -.008735154  -.05003067
                        21221 2018 2017 2016 2019 2020            .           .   .14528252
                            .    .    .    .    .    .            .           .           .
                        18634 2011 2010 2009 2012 2013            .           .           .
                        21609 2019 2018 2017 2020 2021            .           . -.013974732
                            .    .    .    .    .    .   -.06123153   .06380352    .1157154
                            .    .    .    .    .    .            .     .474049   -.6970609
                        19366 2013 2012 2011 2014 2015            .           .           .
                            .    .    .    .    .    .   .008754773   .18127476   .06004237
                        18380 2010 2009 2008 2011 2012            .           .           .
                        18210 2009 2008 2007 2010 2011            .           .           .
                            .    .    .    .    .    .  .0008839766   .10723875   .04552208
                            .    .    .    .    .    .            .           .           .
                        18778 2011 2010 2009 2012 2013            .           .           .
                            .    .    .    .    .    .  -.033212148   .12586528   .12090952
                        21798 2019 2018 2017 2020 2021            .           .           .
                            .    .    .    .    .    .   -.03096497  -.01950812   .16642158
                        21664 2019 2018 2017 2020 2021            .           .           .
                        21599 2019 2018 2017 2020 2021            .           .           .
                        18224 2009 2008 2007 2010 2011            .           .           .
                            .    .    .    .    .    .     .1718072   .18113308   .10803114
                        19348 2012 2011 2010 2013 2014            .           .           .
                        18674 2011 2010 2009 2012 2013            .           .           .
                            .    .    .    .    .    .     .0611223   .06359548  -.01978191
                        21490 2018 2017 2016 2019 2020            .           .           .
                            .    .    .    .    .    .            .   -.0907169   .13367794
                        18799 2011 2010 2009 2012 2013            .           .           .
                        19421 2013 2012 2011 2014 2015            .           .           .
                            .    .    .    .    .    .            .           .    .8489805
                        18427 2010 2009 2008 2011 2012            .           .           .
                            .    .    .    .    .    .            .           .           .
                        18749 2011 2010 2009 2012 2013            .           .           .
                        18127 2009 2008 2007 2010 2011            .           .           .
                            .    .    .    .    .    .            .           .           .
                            .    .    .    .    .    .            .           .           .
                            .    .    .    .    .    .    .03873683   .13158947   .05655027
                        18060 2009 2008 2007 2010 2011            .           .           .
                            .    .    .    .    .    .            .           .           .
                        20200 2015 2014 2013 2016 2017            .           .           .
                        19242 2012 2011 2010 2013 2014            .           .           .
                            .    .    .    .    .    . -.0020108148   .04992725   .06495913
                        21438 2018 2017 2016 2019 2020            .           .           .
                        18632 2011 2010 2009 2012 2013            .           .           .
                        18002 2009 2008 2007 2010 2011            .           .           .
                            .    .    .    .    .    .            .   .10348935   .09738063
                            .    .    .    .    .    .            .           .           .
                        19367 2013 2012 2011 2014 2015            .           .           .
                        20313 2015 2014 2013 2016 2017            .           .           .
                        18773 2011 2010 2009 2012 2013            .           .           .
                            .    .    .    .    .    .            .   .04087559   .05813669
                        21489 2018 2017 2016 2019 2020            .           .           .
                        21850 2019 2018 2017 2020 2021            .           .           .
                        18339 2010 2009 2008 2011 2012            .           .           .
                        18207 2009 2008 2007 2010 2011            .           .           .
                        19380 2013 2012 2011 2014 2015            .           .           .
                            .    .    .    .    .    .   -.08970896  -.01872748   .11219966
                            .    .    .    .    .    .            .   .14231105   .04889004
                        19149 2012 2011 2010 2013 2014            .           .           .
                            .    .    .    .    .    .            .           .           .
                        20656 2016 2015 2014 2017 2018            .           .           .
                        21432 2018 2017 2016 2019 2020            .           .           .
                            .    .    .    .    .    .            .           .           .
                        21920 2020 2019 2018 2021 2022            .           .           .
                        19083 2012 2011 2010 2013 2014            .           .           .
                        17665 2008 2007 2006 2009 2010            .           .           .
                        18417 2010 2009 2008 2011 2012            .           .           .
                        19180 2012 2011 2010 2013 2014            .           .           .
                        19389 2013 2012 2011 2014 2015            .   .08356226   .22711875
                        18483 2010 2009 2008 2011 2012            .           .           .
                        21382 2018 2017 2016 2019 2020            .           .           .
                        21396 2018 2017 2016 2019 2020            .           .           .
                        19961 2014 2013 2012 2015 2016            .           .           .
                        21097 2017 2016 2015 2018 2019            .           .           .
                        21529 2018 2017 2016 2019 2020            .           .           .
                        20758 2016 2015 2014 2017 2018            .           .           .
                        19151 2012 2011 2010 2013 2014            .           .           .
                        21784 2019 2018 2017 2020 2021            .   -.9659526    .6485248
                        21325 2018 2017 2016 2019 2020            .           .           .
                        18389 2010 2009 2008 2011 2012            .           .           .
                        18665 2011 2010 2009 2012 2013            .           .           .
                        21748 2019 2018 2017 2020 2021            .           .           .
                            .    .    .    .    .    .    .06354968   .09862512   .14745726
                        18760 2011 2010 2009 2012 2013            .           .           .
                        19323 2012 2011 2010 2013 2014            .           .           .
                        19401 2013 2012 2011 2014 2015            .  .016072901   .22033365
                        19883 2014 2013 2012 2015 2016            .           .           .
                            .    .    .    .    .    .    -.2215922   .15027463   .25048295
                            .    .    .    .    .    .            .   .06119661   .09356064
                        21691 2019 2018 2017 2020 2021            .           .           .
                            .    .    .    .    .    .            .           .           .
                        20303 2015 2014 2013 2016 2017            .           .           .
                        19401 2013 2012 2011 2014 2015            .           .   1.5251902
                            .    .    .    .    .    .            .   .23252465  .024884807
                        19569 2013 2012 2011 2014 2015            .           .           .
                        20052 2014 2013 2012 2015 2016            .           .           .
                            .    .    .    .    .    .            .           .           .
                            .    .    .    .    .    .            .           .           .
                        end
                        format %td DealDate
I am currently using Stata15. Does anyone has an Idea of how to solve this?
Thanks in advance!