BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
merge ACCT_NEW_ALL_MAC(IN=A) rate_MAC DEC_ACCT_MAC_OCA_SUM2;
by account_no
if a

Select * from  ACCT_NEW_ALL_MAC A 
left join rate_MAC B on A.account_no=B.account_no
left join DEC_ACCT_MAC_OCA_SUM2 C A.account_no=C.account_no

Hi I am trying to write SAS merging three tables into SQL, please could you review for me and let me know if it make sense?

Thanks.

3 REPLIES 3
LinusH
Tourmaline | Level 20

Sure, unless you have other logic in the data step this (almost) the same logic.

But if it's existing code, why change (unless it's to be sent down to a database for processing)?

Data never sleeps
PeterClemmensen
Tourmaline | Level 20

Hard to say without seeing your entire code, but looks right.

ballardw
Super User

How many variables are in common between the data sets other than the By variable(s)?

If there are any then the result of the Merge is almost certainly going to be quit different than that SQL.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 514 views
  • 0 likes
  • 4 in conversation