Hi,
I'm very new in SAS and I have problem which is difficult to me to settle.
I have two datasets.
First is:
name | age |
cole | 12 |
emma | 13 |
lisa | 15 |
Second is:
answer |
lisa_my_name |
what?? |
How can I merge them by macro only for cases in which answer has values of name variable. The results should be:
answer | age |
lisa_my_name | 15 |
Hi @aaaaa34 All you need is a simple inner join or in other words a match merge
proc sql;
create table want as
select a.*,b.*
from second a inner join first b
on answer=name;
quit;
Hi @aaaaa34 All you need is a simple inner join or in other words a match merge
proc sql;
create table want as
select a.*,b.*
from second a inner join first b
on answer=name;
quit;
I edited my post to show you more complex cases.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.