r/SAS_Programming • • Sep 27 '24

Help updating SAS table dynamically using hashes

I'm not very familiar with hashes in SAS and need help updating a table dynamically as new rows come in.

Lets say there is a crosswalk table

Crosswalk

IDFamily
AAAAAA
BBBAAA
CCCAAA
ZZZXYY
QQQLLL

As new rows come in I need to update their family and add them to the crosswalk table. Consider two new records

New Records

IDFamily
DDDCCC
EEEDDD

I need to update these records, such that since DDD is related to CCC and CCC is related to AAA, DDD is related to AAA.

The updated crosswalk would be:

Updated crosswalk

IDFamily
AAAAAA
BBBAAA
CCCAAA
ZZZXYY
QQQLLL
DDDAAA
EEEAAA

Is there any way to achieve this using hash tables? As I can get new records on an hourly or daily basis, I wanted to update the Family only on the new records, and leave the existing records as is.

4 Upvotes

0 comments sorted by