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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1097 views
  • 0 likes
  • 4 in conversation