Hi All,
I have a question with merging two datasets. I want to merge table A with table B and get all the observations in table A that doesn't match with table B. I don't want the matched observations. I have something like this for all matched observations from table A and matching with table B.
DATA matched1; MERGE test1(IN = a) test2;
BY gender age;
IF a;
RUN;
I know this gives all the observations from test1 and those matching from test2. But I want the non-matched one, can I do something like this:
DATA matched1; MERGE test1(IN = a) test2(in=b);
BY gender age;
IF a and not b; /*Not sure if this is the right statement to use in SAS*/
RUN;
Please advise!
Thank you,
Malathi
Your second DATA step is correct for what you want. There is no harm in testing it for yourself to see if it gives your the results you want.
Your second DATA step is correct for what you want. There is no harm in testing it for yourself to see if it gives your the results you want.
if not b ;
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.