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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 919 views
  • 0 likes
  • 4 in conversation