title: Multiple hash objects in SAS
body: <p>I have two SAS data sets. The first is relatively small, and contains unique dates and a corresponding ID:</p>
  
  <pre><code>date   dateID
  1jan90     10
  2jan90     15
  3jan90     20
  ...
  </code></pre>
  
  <p>The second data set very large, and has two date variables:</p>
  
  <pre><code>dt1     dt2
  1jan90  2jan90
  3jan90  1jan90
  ...
  </code></pre>
  
  <p>I need to match both <code>dt1</code> and <code>dt2</code> to <code>dateID</code>, so the output would be:</p>
  
  <pre><code>id1  id2
  10   15
  20   10
  </code></pre>
  
  <p>Efficiency is very important here. I know how to use a hash object to do one match, so I could do one data step to do the match for <code>dt1</code> and then another step for <code>dt2</code>, but I'd like to do both in one data step. How can this be done?</p>
  
  <p>Here's how I would do the match for just <code>dt1</code>:</p>
  
  <pre><code>data tbl3;
   if 0 then set tbl1 tbl2;
  
   if _n_=1 then do;
    declare hash dts(dataset:'work.tbl2');
    dts.DefineKey('date');
    dts.DefineData('dateid');
    dts.DefineDone();
   end;
  
   set tbl1;
   if dts.find(key:date)=0 then output;
   run;
  </code></pre>