BookmarkSubscribeRSS Feed
PGStats
Opal | Level 21

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

PG
Reeza
Super User

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.

esjackso
Quartz | Level 8

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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 3181 views
  • 4 likes
  • 7 in conversation