Adds the specified data that is associated with the given key to the hash object.
Applies to: | Hash object |
specifies whether the method succeeded or failed.
specifies the name of the hash object.
specifies the key value whose type must match the corresponding key variable that is specified in a DEFINEKEY method call.
specifies the data value whose type must match the corresponding data variable that is specified in a DEFINEDATA method call.
data _null_;
length k $8;
length d $12;
/* Declare hash object and key and data variable names */
if _N_ = 1 then do;
declare hash h();
rc = h.defineKey('k');
rc = h.defineData('d');
rc = h.defineDone();
end;
/* Define constant key and data values */
k = 'Joyce';
d = 'Ulysses';
/* Add key and data values to hash object */
rc = h.add();
run;
data _null_;
length k $8;
length d $12;
/* Define hash object and key and data variable names */
if _N_ = 1 then do;
declare hash h();
rc = h.defineKey('k');
rc = h.defineData('d');
rc = h.defineDone();
/* avoid uninitialized variable notes */
call missing(k, d);
end;
/* Define constant key and data values and add to hash object */
rc = h.add(key: 'Joyce', data: 'Ulysses');
run;