BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11
Hello team,
I have a hash table created:
Data product. Result(drop =IDkey);
If _N_ = 0 then set thisdata;
Declare hash h(dataset: ‘thisdata’);
h.define key =(‘IDkey’);
h.definedata( ‘thisfield’ ‘that field’)
h.defineDone();
Do until (done)
Set sometable end=done;
rc=h.find(key:IDkey);
If rc ne 0 then then do
Thisfield= “ “;
That field=“ “;
End;
Output;
End;
Stop;
Run;


I understood by end of h.define(done), I can’t understand lines afterwards. Any help os greatly appreciated. 🙏🙏🙏🙏blue & blue
Blue Blue
1 REPLY 1
Astounding
PROC Star

rc=

Based on the observation from SOMETABLE, look in the hash table for matching value for IDKey.  Retrieve the values for 'Thisfield' and 'Thatfield' from the hash table, based on a match for IDKey.

 

if rc ne 0

If the search through the hash table does not find a matching value for IDKey, assign missing values to 'Thisfield' and 'Thatfield'

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 441 views
  • 0 likes
  • 2 in conversation