I have two tables set up in the same way, but with different values. Here are samples from each:
Table1:
Date Code Count
1/1/2015 AA 4
1/3/2015 AA 2
1/1/2015 AB 3
Table2:
Date Code Count
1/1/2015 AA 1
1/2/2015 AA 0
1/4/2015 AB 2
I would like the result table to contain all unique date-code pairs, with any duplicates between the tables having the counts of the two summed.
Output_Table:
Date Code Count
1/1/2015 AA 5 /*Summed because found in Table1 and Table2*/
1/2/2015 AA 0
1/3/2015 AA 2
1/1/2015 AB 3
1/4/2015 AB 2
I have no primary key to connect the two tables, and the joins I have tried have either not kept all distinct date-code pairs or have created duplicates.
For reference, I am doing this inside a SAS proc sql statement.