SAS hash table lookup example taken from http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1b4cbtmb049xtn1vh9x4waiioz4.htm and included in this bog so I can find it easily.
data match;
length k 8;
length s 8;
if _N_ = 1 then do;
/* load SMALL data set into the hash object */
declare hash h(dataset: "work.small");
/* define SMALL data set variable K as key and S as value */
h.defineKey('k');
h.defineData('s');
h.defineDone();
/* avoid uninitialized variable notes */
call missing(k, s);
end;
/* use the SET statement to iterate over the LARGE data set using */
/* keys in the LARGE data set to match keys in the hash object */
set large;
rc = h.find();
if (rc = 0) then output;
run;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment