Hello,
Can anyone would help me with below concern.
"What is hashing algorithm in SAS?" , Can anyone explain with example.
Regards,
Jai
What have you searched?
This question has been asked to me in one of the tough SAS interview.
@jaiganesh wrote:
This question has been asked to me in one of the tough SAS interview.
There are so many papers explaining hash-objects, i am sure they can be found using Google, Bing or any other search-site. You could, of course, just read the documentation provided at http://www.sas.com/store/books/categories/usage-and-reference/sas-hash-object-programming-made-easy/...
This question has been asked to me in one of the tough SAS interview.
This does not answer my question. Try to do some of the work yourself and then ask questions.
My reply would be another question: Do you mean the hashing function or the data set hash object?
Calling things by their proper name is always useful.
If you were asked about the "hashing algorithm" in SAS in an interview, then the interviewer does not know the meaning of their own question.
They could be asking about the MD5 or various SHA hashing functions, but I doubt it. It's probably about the hash object, a tool exclusively available in the SAS data step. It is very useful in particular for in-memory data lookup, data splitting, and aggregation, to mention a few. I say "in-memory" because the hash object persists in SAS's memory as you read successive observations in a data step. This persistence (think of it as a "retain" for a data table rather than for just a set of variables) makes it very useful in situations in which you need to read a particular data set more than once to generate the result data of interest. Or perhaps you simply want to "lookup" data in one data set that correspond to a key found in another data set (if the lookup data is accessed multiple times, it's faster to have it in memory than to be re-read from disk).
Aside from being an in-memory object, the hash object data lookup speed is faster than binary search methods. That's because instead of applying the binary search to one big bucket of keys, the same search is applied to a much smaller specific one of (say) 256 mutually exclusive buckets of keys. The trick is to (1) know which bucket to search, and (2) have buckets that contain roughly the same number of keys. That's a property of some hashing functions (for all but the most pathological data), which underlie hash objects where the bucket collection is maintained. As a user of hash objects you never see the underlying hash function - instead you store and retrieve data based on whatever set of keys (say ID variable or ID/DATE combinations) that are relevant to your task.
According to KEY value to find its/corresponding DATA value .
@jaiganesh wrote:Hello,
Can anyone would help me with below concern.
"What is hashing algorithm in SAS?" , Can anyone explain with example.
Regards,
Jai
If by "anyone" you mean Google, then sure...
https://www.google.com/search?q=sas+hash+algorithm
Post back after you've read the first five links.
(In this instance, this will prepare you much better for your next interview than your original post and subsequent replies...)
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.