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

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

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