As featured in: Data Management Solutions Using SAS Hash Table Operations: A Business Intelligence Case Study , and built from this github repository.
createhash.sas
1 /* "createhash.sas" from the SAS Press book
2  Data Management Solutions Using SAS Hash Table Operations:
3  A Business Intelligence Case Study
4 */
5 
6 %macro createHash
7  (lib = dw
8  ,hashTable = hashTable
9  ,metaData = template.Schema_Metadata
10  );
11 
12  if 0 then set template.&hashTable;
13  dcl hash _&hashTable(dataset:"&lib..&hashtable"
14  ,multidata:"Y"
15  ,ordered:"A");
16  lr = 0;
17  do while(lr=0);
18  set &metadata end=lr;
19  where upcase(hashTable) = "%upcase(&hashTable)";
20  if is_a_key then _&hashTable..DefineKey(Column);
21  _&hashTable..DefineData(Column);
22  end;
23  _&hashTable..DefineDone();
24 
25 %mend createHash;