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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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