BookmarkSubscribeRSS Feed
meenakshim
Fluorite | Level 6

Hi All,

     I am in the process of understanding Hash technique to perform dataset merge. I worked out simple examples, but it would be great if someone give me a equivalent hash code to perform below SAS merge.

There are non unique key fields and has OR condition in the where clause of SQL. 

How to implement this query using Hash?

 

Thanks for all your suggestions.

 

proc sql;
create table tablec as
Select distinct a.*
From tablea a join tableb b on ((a.ID =b.ID) or (a.ID=b.CURRENT_ID))
and (a.PROC_CODE =b.PROCEDURE_CODE)
and (a.START_DATE =b.from_date) and (a.END_DATE =b. END_DATE ) ;
quit;

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

For the duplicate keys and for the OR clause, you need to use the duplicate keyword, and to iterate.

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
  • 1 reply
  • 845 views
  • 0 likes
  • 2 in conversation