Before using the Hash table the data fields and their properties must be defined. You can use length and format statements, however the more efficient way is using SET statement. data want (drop=rc rc1 rc2 rc3); If 1=2 then set NewData; /*create hash object once*/ if _n_=1 then do; declare hash hmerge(dataset: 'NewData'); rc1 = hmerge.defineKey('ID', 'lot'); rc2 = hmerge.defineData('Value'); rc3 = hmerge.defineDone(); end; set have ; rc=hmerge.find(key:'ID', key: 'lot'); if rc=0 then value2 = value ; else value2=. ; run; The SET statement will be read at compilation, data variable properties in the datasets will be extracted, but the statement will never actually execute due to the obviously false statement "if 1=2" condition.
... View more