I have a two data tables. One has company wide rating information, the other has price data at a debt-instrument level (company's usually have multiple debt-intsruments) for a historical date range.
The data table with the rating information looks as follows (simplified for illustration):
Company Date Rating
A 2016-02-01 AAA
A 2016-02-02 AA
B 2016-02-01 BBB
B 2016-02-02 A
The debt-instrument data frame looks as follows (simplified for illustration):
Company Debt-Instrument Date Price
A X1 2016-02-01 100
A X1 2016-02-02 101
A X2 2016-02-01 98
A X2 2016-02-02 99
B Y1 2016-02-01 101
B Y1 2016-02-02 100
B Y2 2016-02-01 90
B Y2 2016-02-02 89
As you can see the rating information contains the company name and the date, which is also included in the debt-instrument table.
I would now like to add the rating information to the debt-instrument data table by matching the company name and the date.
The final data table should look as follows:
Company Debt-Instrument Date Price Rating
A X1 2016-02-01 100 AAA
A X1 2016-02-02 101 AA
A X2 2016-02-01 98 AAA
A X2 2016-02-02 99 AA
B Y1 2016-02-01 101 BBB
B Y1 2016-02-02 100 A
B Y2 2016-02-01 90 BBB
B Y2 2016-02-02 89 A
I know how to do a lookup on one single variable, however I do not know how to do it for two variables.