<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hash table finding key in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hash-table-finding-key/m-p/419494#M103160</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone please tell me If is it possible to check if record with specific keys and without other key exist in table by hash table (find() or check() method):&lt;/P&gt;&lt;P&gt;green color is what am trying to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; create table sample3 as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; select t2.zm_cel, t3.zm_cel as zm_cel_sweek,t4.zm_cel as zm_cel_1week,t5.zm_cel as zm_cel_2week,t6.zm_cel as zm_cel_3week,t7.zm_cel as zm_cel_4week, t1.* from temp t1 left join temp2 t2&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; on (t1.id_pesel=t2.id_pesel and t1.week=t2.week and t1.date_record_generation=t2.date_record_generation)&lt;BR /&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and t1.week=t3.week and t1.date_record_generation&amp;lt;&amp;gt;t3.date_record_generation)&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m1=t4.week or t1.week_p1=t4.week))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t5&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m2=t5.week or t1.week_p2=t5.week))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t6&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m3=t6.week or t1.week_p3=t6.week))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t7&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m4=t7.week or t1.week_p4=t7.week));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use hash table because temp2 table is relatively small and sql method is not efficient.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2017 09:00:15 GMT</pubDate>
    <dc:creator>Matt3</dc:creator>
    <dc:date>2017-12-08T09:00:15Z</dc:date>
    <item>
      <title>Hash table finding key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-table-finding-key/m-p/419494#M103160</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone please tell me If is it possible to check if record with specific keys and without other key exist in table by hash table (find() or check() method):&lt;/P&gt;&lt;P&gt;green color is what am trying to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; create table sample3 as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; select t2.zm_cel, t3.zm_cel as zm_cel_sweek,t4.zm_cel as zm_cel_1week,t5.zm_cel as zm_cel_2week,t6.zm_cel as zm_cel_3week,t7.zm_cel as zm_cel_4week, t1.* from temp t1 left join temp2 t2&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; on (t1.id_pesel=t2.id_pesel and t1.week=t2.week and t1.date_record_generation=t2.date_record_generation)&lt;BR /&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#008000"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and t1.week=t3.week and t1.date_record_generation&amp;lt;&amp;gt;t3.date_record_generation)&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m1=t4.week or t1.week_p1=t4.week))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t5&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m2=t5.week or t1.week_p2=t5.week))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t6&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m3=t6.week or t1.week_p3=t6.week))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; left join temp2 t7&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;on (t1.id_pesel=t2.id_pesel and (t1.week_m4=t7.week or t1.week_p4=t7.week));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use hash table because temp2 table is relatively small and sql method is not efficient.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 09:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-table-finding-key/m-p/419494#M103160</guid>
      <dc:creator>Matt3</dc:creator>
      <dc:date>2017-12-08T09:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hash table finding key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-table-finding-key/m-p/419545#M103174</link>
      <description>&lt;P&gt;Let's say you want all the records in dataset HAVE, which match variable A in dataset TEST, but do not match the combination of A&amp;amp;B in TEST. Although it could&amp;nbsp;be done&amp;nbsp;with a single hash object, this two-hash-object solution (untested) is simpler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if _n_=1 then do;
    declare hash h1 (dataset:'test (keep=a)');
      h1.definekey(all:'Y');
      h1.definedone();
    declare hash h2 (dataset:'test (keep=a b)');
      h2.definekey(all:'Y');
      h2.definedone();
  end;

  rc1=h1.check();
  if rc1=0;
  rc2=h2.check();
  if rc2^=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Dec 2017 13:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-table-finding-key/m-p/419545#M103174</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-12-08T13:13:34Z</dc:date>
    </item>
  </channel>
</rss>

