The hash object keeps the multiple values in a list that is associated with the key. This list can be traversed and manipulated by using several methods such as HAS_NEXT or FIND_NEXT. See the first example in Better Hashing in SAS® 9.2 data _null_; length key 8 data $ 8; if (_n_ = 1) then do; declare hash myhash(dataset: "table",multidata: "y"); rc = myhash.definekey('key'); rc = myhash.definedata('data'); myhash.definedone(); end; do key = '531', '620', '908', '143'; rc = myhash.find(); if (rc = 0) then do; put key= @15 data=; myhash.has_next(result: r); do while(r ne 0); myhash.find_next(); put key= @15 data= @25 '(dup)'; myhash.has_next(result: r); end; end; end; run;
... View more