And a note: There's something to keep in mind if you are playing with very very very large dataset and composite keys as hash keys that would not fit in memory and may have to be treated with MD5 or SHA256 hash algorithms to make it compatible. However, in my 5+ years of SAS experience, I haven't encountered the need to be concerned about that yet. But always good to be aware though.
@novinosrin .. Thank you so much . I'll keep it in mind. Just have one more query .
if i declared has object as below. Does it's feasible in comparison open declaration of hash object .
if _n_=1 then do;
declare hash h(dataset:'test1');
h.definekey('id','site');
h.definedata('name');
h.definedone();
end;
I don't comprehend what you mean by " open declaration"
Are you trying to mean:
open declaration is
if _n_=1 then do;
dcl hash statements......
end;
vs
just
dcl hash....
....
?
If that above is what your question is, I'd suggest the not so regular hash users to use the one you suggested as opposed to the style i showed that loops through the set until the confidence and expertise gets to a certain level.
There will be a time, as the requirement narrates to the mind, the code is in the fingers. This is when we feel we are in SAS world 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.