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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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