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