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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.