<?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 Re: HASH Join on Table Containing Duplicate values in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/HASH-Join-on-Table-Containing-Duplicate-values/m-p/482147#M15029</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221594"&gt;@jpm2478&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Not really sure what you're asking for but may-be below code will give you some ideas.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lookup;
  key=1;
  do value=2 to 10 by 2;
    output;
  end;
  stop;
run;

data _null_;
  if 0 then set lookup;
  dcl hash h1(dataset:'lookup', multidata:'y');
  h1.defineKey('key');
  h1.defineData('value');
  h1.defineDone();
  dcl hash h2(dataset:'lookup', multidata:'y');
  h2.defineKey('key');
  h2.defineData('value');
  h2.defineDone();
  
  key=1;

  /* removed item with value=6 */
  do while(h1.do_over()=0);
    if value=6 then
      do;
        h1.removedup();
        leave;
      end;
  end;
  h1.output(dataset:'h1');

  /* remove items with value &amp;lt;&amp;gt; 6 */
  do while(h2.do_over()=0);
    if value ne 6 then
      do;
        h2.removedup();
      end;
  end;
  h2.output(dataset:'h2');

  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 28 Jul 2018 03:28:48 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2018-07-28T03:28:48Z</dc:date>
    <item>
      <title>HASH Join on Table Containing Duplicate values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HASH-Join-on-Table-Containing-Duplicate-values/m-p/482114#M15028</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm doing join between 2 tables. A and B. B has duplicate records . First, I need the rows to repeat so duplicate is not a problem. Once the join is done I have to check on some conditions and if they are met I need to delete those rows. I'm using the below code but it is not deleting the right rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First condition is one Variable which is "EQ". If EQ=0 then I want to delete that row from hash.&lt;/P&gt;&lt;P&gt;second condition is if EQ&amp;gt;10 then leave the Ist row but delete any other duplicate rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set WORK.lookup_2 ;&lt;BR /&gt;do _iorc_ = b.find(key:A,key:B) by 0 while (_iorc_ = 0) ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if eq=0 then _iorc_ = b.removedup();&lt;BR /&gt;_iorc_ = b.find_next() ;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 23:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HASH-Join-on-Table-Containing-Duplicate-values/m-p/482114#M15028</guid>
      <dc:creator>jpm2478</dc:creator>
      <dc:date>2018-07-27T23:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: HASH Join on Table Containing Duplicate values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/HASH-Join-on-Table-Containing-Duplicate-values/m-p/482147#M15029</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221594"&gt;@jpm2478&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Not really sure what you're asking for but may-be below code will give you some ideas.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lookup;
  key=1;
  do value=2 to 10 by 2;
    output;
  end;
  stop;
run;

data _null_;
  if 0 then set lookup;
  dcl hash h1(dataset:'lookup', multidata:'y');
  h1.defineKey('key');
  h1.defineData('value');
  h1.defineDone();
  dcl hash h2(dataset:'lookup', multidata:'y');
  h2.defineKey('key');
  h2.defineData('value');
  h2.defineDone();
  
  key=1;

  /* removed item with value=6 */
  do while(h1.do_over()=0);
    if value=6 then
      do;
        h1.removedup();
        leave;
      end;
  end;
  h1.output(dataset:'h1');

  /* remove items with value &amp;lt;&amp;gt; 6 */
  do while(h2.do_over()=0);
    if value ne 6 then
      do;
        h2.removedup();
      end;
  end;
  h2.output(dataset:'h2');

  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Jul 2018 03:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/HASH-Join-on-Table-Containing-Duplicate-values/m-p/482147#M15029</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-07-28T03:28:48Z</dc:date>
    </item>
  </channel>
</rss>

