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;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.