Hey guys! I'm Dennis Stap from the Netherlands, and have quite the issue momentarily.
My main dataset is composed of annual data and (having removed most other variables for simplicity) looks like this:
total_curr year cusip
265.849 2006 00036020
However, my secondary database is composed of yearly data, which is then split into quarters on a manager level:
cusip mgrno quarter Year PCTQ1 PCTQ2
00036020 26600 1 2006 0,10 -
00036020 10681 2 2006 - 0,20
It may look a little weird, but the main idea was that I computed totals per company(cusip) in quarter x. These totals are computed by summing all the manager (mgrno) level data for cusip x, in year x, in quarter x. For simplicity sake, PCTQ1 and PCTQ2 are the variables I need, and are the same in any observation in year x and quarter x. I tried to make this clear by showing that PCTQ1 is not filled in quarter 2, and PCTQ2 is not filled in quarter 1.
My end goal would be that my main dataset would look like this:
total_curr year cusip PCTQ1 PCTQ2
265.849 2006 00036020 0,10 0,20
I tried merging the datasets, but then quarters started appearing in my main dataset. I think I have to reduce my secondary dataset to look like this, but I am not really sure at this moment:
year cusip PCTQ1 PCTQ2
2006 00036020 0,10 0,20
If anybody has an idea how to tackle this problem, I would be very grateful! Thanks in advance
My main dataset is composed of annual data and (having removed most other variables for simplicity) looks like this:
total_curr year cusip
265.849 2006 00036020
However, my secondary database is composed of yearly data, which is then split into quarters on a manager level:
cusip mgrno quarter Year PCTQ1 PCTQ2
00036020 26600 1 2006 0,10 -
00036020 10681 2 2006 - 0,20
It may look a little weird, but the main idea was that I computed totals per company(cusip) in quarter x. These totals are computed by summing all the manager (mgrno) level data for cusip x, in year x, in quarter x. For simplicity sake, PCTQ1 and PCTQ2 are the variables I need, and are the same in any observation in year x and quarter x. I tried to make this clear by showing that PCTQ1 is not filled in quarter 2, and PCTQ2 is not filled in quarter 1.
My end goal would be that my main dataset would look like this:
total_curr year cusip PCTQ1 PCTQ2
265.849 2006 00036020 0,10 0,20
I tried merging the datasets, but then quarters started appearing in my main dataset. I think I have to reduce my secondary dataset to look like this, but I am not really sure at this moment:
year cusip PCTQ1 PCTQ2
2006 00036020 0,10 0,20
If anybody has an idea how to tackle this problem, I would be very grateful! Thanks in advance
Comment