I have data that has a reference date and a publish date. Similar to economic reports which are published/released on different dates than they reference (i.e. Q4 GDP for 2014 references the date 12/31/2014 but is published the following week on 01/07/2015). Multiple references date values can be published on a single publish date. I want to be able to add data together which has similar structure just with misaligned and duplicate reference and publish dates.
Below is a sample of the data for Item A:
Publish_ItemA Reference_ItemA Value_ItemA
2002-01-10 00:00:00.000 2001-09-30 00:00:00.000 83
2002-02-14 00:00:00.000 2001-12-31 00:00:00.000 48
2002-05-23 00:00:00.000 2002-03-31 00:00:00.000 57
2002-08-15 00:00:00.000 2002-06-30 00:00:00.000 41
2002-12-31 00:00:00.000 2002-09-30 00:00:00.000 18
2003-02-13 00:00:00.000 2002-12-31 00:00:00.000 18
2003-05-22 00:00:00.000 2003-03-31 00:00:00.000 29
2003-08-21 00:00:00.000 2003-06-30 00:00:00.000 40
2003-12-31 00:00:00.000 2003-09-30 00:00:00.000 51
2004-12-16 00:00:00.000 2002-12-31 00:00:00.000 17
2004-12-16 00:00:00.000 2003-03-31 00:00:00.000 28
2004-12-16 00:00:00.000 2003-06-30 00:00:00.000 33
2004-12-16 00:00:00.000 2003-09-30 00:00:00.000 60
2004-12-16 00:00:00.000 2003-12-31 00:00:00.000 107
Below is a sample of the data for Item B:
Publish_ItemB Reference_ItemB Value_ItemB
2001-01-25 00:00:00.000 2000-12-31 00:00:00.000 -207
2001-04-25 00:00:00.000 2000-12-31 00:00:00.000 -195
2001-04-25 00:00:00.000 2001-03-31 00:00:00.000 43
2001-07-19 00:00:00.000 2001-06-30 00:00:00.000 61
2001-10-18 00:00:00.000 2001-09-30 00:00:00.000 66
2002-01-17 00:00:00.000 2001-12-31 00:00:00.000 38
2002-04-24 00:00:00.000 2002-03-31 00:00:00.000 40
2002-07-18 00:00:00.000 2002-06-30 00:00:00.000 32
2002-10-17 00:00:00.000 2002-09-30 00:00:00.000 -45
2003-01-16 00:00:00.000 2002-12-31 00:00:00.000 -8
2003-04-24 00:00:00.000 2003-03-31 00:00:00.000 14
2003-07-17 00:00:00.000 2003-06-30 00:00:00.000 19
2003-10-23 00:00:00.000 2003-09-30 00:00:00.000 44
2004-01-22 00:00:00.000 2003-12-31 00:00:00.000 63
I would like to be able to do alignments and arithmetic with columns of values (i.e. itemAframe?Value_ItemA + itemBframe?Value_ItemB) and return a series with either the reference date or the publish date dependent on which was required.
Aligning with the reference date is easy because the dates are non-overlapping so there is no issue with a duplicate key, but returning the frame with a publish date is problematic because not all keys will be unique
Any suggestion would be much appreciated.
Thanks!