BookmarkSubscribeRSS Feed
astha8882000
Obsidian | Level 7

So my code worked, I honestly did so many hit and trials that I really am not sure what made it work, will continue my R&D on that later. But I wanted to understand a very basic purpose of a hash table here:

 

I have a dataset abc, which gets the values from dataset xyz, then what purpose does the hash table serve? Does hh help abc pick values from xyz based on unique phoneno values?

 

data abc;

IF _n_ = 1 THEN DO; 

dcl hash hh (dataset: ''xyz");

hh.definekey ('phoneno');

hh.definedone();

end;

set xyz;

run;

 

novinosrin
Tourmaline | Level 20

You wrote- "I really am not sure what made it work, will continue my R&D on that later". 

 

I like that. 

 

This is just a heads up to give you an idea what's purpose of hash object to begin with. The hash object stores data as key::value pairs in a so called virtual table or you can call it look up table. Basically, we try to match the key with a key in another table and fetch the associated data with key, very similar to a join so to speak. With this understanding your further reading will be more comprehensible. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 31 replies
  • 3994 views
  • 4 likes
  • 6 in conversation