Defines data, associated with the specified data variables, to be stored in the hash object.
Applies to: | Hash object |
specifies whether the method succeeded or failed.
specifies the name of the hash object.
specifies the name of the data variable.
specifies all the data variables as data when the data set is loaded in the object constructor.
h.add(key:99,
data:'apple', data:'orange')
)
and use the ALL:'YES' option on the DEFINEDATA method, then
you must specify the data in the same order as it exists in the data
set.
h.find(key:'abc')
),
and the SAS compiler cannot detect the key and data variable assignments
that are performed by the hash object and the hash iterator. Therefore,
if no assignment to a key or data variable appears in the program,
then SAS will issue a note stating that the variable is uninitialized.
To avoid receiving these notes, you can perform one of the following
actions:
length d $20; length k $20; if _N_ = 1 then do; declare hash h(); rc = h.defineKey('k'); rc = h.defineData('d'); rc = h.defineDone(); call missing(k,d); end;
data _null_;
length d $20;
length k $20;
/* Declare the hash object and key and data variables */
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;
run;