Hello,
I'm writing my master thesis and for this, I need to merge several files together. The files contain an ID number for a company (ISIN) and a year variable. Each company is filtered on an M&A completion date and I gathered data 1 year before that date and 5 years after that date. Someone told me to merge the files by using "rangejoin year start_year end_year using "datafile", by(ISIN)"
However, when I do this my data doesn't fit the correct years together. For example I have:
ISIN year TimeInComMean NmbDirectMean
BMG6891L1054 2013 .2 5
BMG6891L1054 2014 .2 8
BMG6891L1054 2015 1.2 9
BMG6891L1054 2016 2.2 9
BMG6891L1054 2017 4.2 9
BMG6891L1054 2018 4.2 9
BMG6891L1054 2019 6.2 9
And when I merge it according to the code it becomes
ISIN TICKER date year start_year end_year ISIN_N year_U TimeInComMean NmbDirectMean
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2013 .2 5
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2014 .2 8
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2015 1.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2016 2.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2017 4.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2018 4.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2019 6.2 9
I already created ISIN_N before in order to make a panel data set. year_U is the correct year but I want Stata to make the year variable as the only year variable in which year_U will merge and add the years it has data on. As long as this year is in the start_year and end_year range.
I could work further with the year_U but I will be adding more files in the same way and I will create like 4/5 different year variables, which should be 1 complete year variable.
I hope someone can help me out.
Kind regards,
Daan
I'm writing my master thesis and for this, I need to merge several files together. The files contain an ID number for a company (ISIN) and a year variable. Each company is filtered on an M&A completion date and I gathered data 1 year before that date and 5 years after that date. Someone told me to merge the files by using "rangejoin year start_year end_year using "datafile", by(ISIN)"
However, when I do this my data doesn't fit the correct years together. For example I have:
ISIN year TimeInComMean NmbDirectMean
BMG6891L1054 2013 .2 5
BMG6891L1054 2014 .2 8
BMG6891L1054 2015 1.2 9
BMG6891L1054 2016 2.2 9
BMG6891L1054 2017 4.2 9
BMG6891L1054 2018 4.2 9
BMG6891L1054 2019 6.2 9
And when I merge it according to the code it becomes
ISIN TICKER date year start_year end_year ISIN_N year_U TimeInComMean NmbDirectMean
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2013 .2 5
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2014 .2 8
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2015 1.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2016 2.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2017 4.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2018 4.2 9
BMG6891L1054 PANL 10feb2014 2014 2013 2019 12 2019 6.2 9
I already created ISIN_N before in order to make a panel data set. year_U is the correct year but I want Stata to make the year variable as the only year variable in which year_U will merge and add the years it has data on. As long as this year is in the start_year and end_year range.
I could work further with the year_U but I will be adding more files in the same way and I will create like 4/5 different year variables, which should be 1 complete year variable.
I hope someone can help me out.
Kind regards,
Daan