Hi,
If you want all observations from either than do:
proc sql;
create table want as
select COALESCE(FIRST_TABLE.ID,SECOND_TABLE.ID) as ID,
...
from FIRST_TABLE
full join SECOND_TABLE
on FIRST_TABLE.ID=SECOND_TABLE.ID;
quit;
The full join means all rows from both tables are merged on id giving full list, you do need the coalesce to get id populated, as if you just take first table then it would be missing for those which appear only in second table.
Another approach from @PGStats:
You should use a CROSS JOIN to get all combinations of ID and trading_date and then LEFT JOIN to your trading data :
proc sql;
create table joined as
select I.ID, a.trading_date as date, b.price
from
(select unique ID from b) as I cross join
a left join
b on I.ID=b.ID and a.trading_date=b.date
order by ID, date;
quit;
... View more