Hi,
I have two datasets dataset a and dataset b.
ex:dataset a
id value
123 xyz
456 wxy
112345 abc
dataset b
id product
123 def
456 tss
789 klm
i want to map product for each id in dataset a from dataset b
final dataset should look like this:
id value product
123 xyz def
456 wxy tss
112345 abc
I'm using left outer join on id....but not getting desired results.
how can i do this.
Thanks,
rk.
A standard left join should work.
ie
proc sql;
create table want as
select a.id, a.value, b.product
from tablea a
left join tableb b
on a.id=b.id;
quit;
You can (should) post your code if something like the above isn't working for you.
Yes,the same code i have if i test on large dataset it is not working.
getting more records than actual records.
Regards,
rk
Your right hand dataset must have duplicate records for the id variables. If they are exact duplicates then adding the DISTINCT keyword after the SELECT keyword will reduce the number of records.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.