BookmarkSubscribeRSS Feed
nnnwf
Fluorite | Level 6
proc sql;
     select * 
     from may_nomatch_2 a
     inner join march2018_3_9char b on a.Loan_9 = b.LOAN and a.PropZIP = b.Property_Zip;
quit;

data;
     merge may_nomatch_2(rename=(Loan_9=LOAN PropZIP=Property_Zip)) march2018_3_9char;
     by Loan_9 PropZIP;
run;

I have above code. proc sql shows how I would do the join using sql. But I want to perform the join using merge and not sure how to do it

 

it is an inner join using 2 columns

those 2 columns don't have same name in both tables

1 REPLY 1
Reeza
Super User

Try adding the IN option to both on the data set statement and then filtering on that to control for an inner join.

 

data;
     merge may_nomatch_2(IN=T1 rename=(Loan_9=LOAN PropZIP=Property_Zip)) 
                march2018_3_9char (IN=T2);
     by Loan_9 PropZIP;

If T1 and T2; *inner join;

run;

SAS Innovate 2025: Call for Content

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1744 views
  • 0 likes
  • 2 in conversation