Well, great minds think alike, I mean you and the SAS people; I read somewhere that the "very efficient lookup mechanism" that I was referring to is in fact based on hashing. But if formats are not flexible enough for your purpose, others on the Forum (e.g. , ) would be much more skillful at devising solutions based on the hash object.
PG
I thought formats used a binary search algorithm which is O(log n)
While hash is O(n)
Meaning that formats are faster than hash for a lookup
Or do I understand something wrong...I'm only starting to dip into hash myself.
Charlotte,
I guess the real question is ,,, who is defining the codes. If you are then a system like suggested should work. However if the codes are dictated else where, you are going to have to bring them into sas in some fashion either through directly writing them in the code (through cards or hand written format) or through read in of a spreadsheet or table elsewhere.
What I was not quite understanding (may just be me), you say you dont want to have multiple if then statements but your do loop seems to be doing just that since you are looping through all the codes.It looks to me just gaining less coding but no gained processing efficiency.
The format method or just a plain ol merge would eliminate the if then statements all together provided you can get the lookup table into sas.
EJ
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.