BookmarkSubscribeRSS Feed
wcpatton
Calcite | Level 5
Trying to determine the syntax for converting the following (simplified) process to a hash merge for speed purposes. Thanks!

data c;
merge a(in=ina keep = loan_no) b(in=inb keep=loan_no product);
by loan_no;
if ina;
run;

Should only keep loans in A and find the product in B....
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS support http://support.sas.com/ website has several excellent technical / conference reference items on this topic.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

hash table merge site:sas.com
SASKiwi
PROC Star
Please note that a hash merge is not the only way to improve performance. A lookup SAS format created from your product table can also be a lot faster and simpler to code.The number of discrete loan numbers are you joining on should influence your chosen lookup technique. Be aware there are memory limitations with both hash tables and lookup formats.
Ksharp
Super User
[pre]
data a(drop=rc);
declare hash hh(hashexp:10);
hh.definekey('loan_no');
hh.definedata('product');
hh.definedone();

do until(last);
set b( keep=loan_no product) end=last;
then hh.add();
end;

do until(_last);
set a(keep = loan_no) end=_last;
call missing(product);
rc=hh.find();
output;
end;
stop;
run;
[/pre]


Ksharp Message was edited by: Ksharp

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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