<?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 how to incorporate 'NODUPKEY' in hash? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30101#M7097</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman';"&gt;&lt;A href="http://www.lexjansen.com/pharmasug/2011/tt/pharmasug-2011-tt15.pdf"&gt;http://www.lexjansen.com/pharmasug/2011/tt/pharmasug-2011-tt15.pdf&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2012 19:07:05 GMT</pubDate>
    <dc:creator>sassharp</dc:creator>
    <dc:date>2012-03-13T19:07:05Z</dc:date>
    <item>
      <title>how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30100#M7096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;need to incorporate 'NODUPKEY' in hash short as in proc sort nodupkey. Any examples?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30100#M7096</guid>
      <dc:creator>sassharp</dc:creator>
      <dc:date>2012-03-13T19:05:43Z</dc:date>
    </item>
    <item>
      <title>how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30101#M7097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman';"&gt;&lt;A href="http://www.lexjansen.com/pharmasug/2011/tt/pharmasug-2011-tt15.pdf"&gt;http://www.lexjansen.com/pharmasug/2011/tt/pharmasug-2011-tt15.pdf&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman';"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30101#M7097</guid>
      <dc:creator>sassharp</dc:creator>
      <dc:date>2012-03-13T19:07:05Z</dc:date>
    </item>
    <item>
      <title>how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30102#M7098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;A href="http://www2.sas.com/proceedings/sugi30/236-30.pdf"&gt;http://www2.sas.com/proceedings/sugi30/236-30.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30102#M7098</guid>
      <dc:creator>sassharp</dc:creator>
      <dc:date>2012-03-13T19:08:52Z</dc:date>
    </item>
    <item>
      <title>how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30103#M7099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input id&amp;nbsp; var @@;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 1 3 10 6 4 5 10 7 8 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then do;&lt;/P&gt;&lt;P&gt; dcl hash h( ordered: 'a');&lt;/P&gt;&lt;P&gt; h.definekey('id');&lt;/P&gt;&lt;P&gt; h.definedata('id','var');&lt;/P&gt;&lt;P&gt; h.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until (done);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have end=done;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _rc=h.add();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt; h.output(dataset:'want');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30103#M7099</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-13T19:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30104#M7100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The hash object by default drops duplicate keys.&amp;nbsp; This is controlled by the duplicate option which tells SAS whether to replace or error when a duplicate key is encountered (when loading a dataset into a hash using the dataset option).&amp;nbsp; To avoid this use the multidata:'y' option in the declare statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002576871.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002576871.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out the post by &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://communities.sas.com/people/MikeZdeb" id="jive-17833132154131731577803" style="background-color: #f9f9f9; font-size: 12px; color: #0e66ba; font-weight: bold; font-family: Arial, Helvetica, sans-serif; text-align: center;"&gt;MikeZdeb&lt;/A&gt; in the link for a great list of reference papers for learning about Hash objects in SAS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/33376?tstart=0"&gt;http://communities.sas.com/thread/33376?tstart=0&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30104#M7100</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-03-13T19:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30105#M7101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reminded by FriedEgg's comments "The hash object by default drops duplicate keys.", add() method is not needed for this purpose if choose to load the dataset once for all. However, if chose the last record when duplicating, replace() may still be needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input id&amp;nbsp; var @@;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 1 3 10 6 4 5 10 7 8 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have (obs=1);&lt;/P&gt;&lt;P&gt;dcl hash h( dataset: 'have', ordered: 'a');&lt;/P&gt;&lt;P&gt;h.definekey('id');&lt;/P&gt;&lt;P&gt;h.definedata('id','var');&lt;/P&gt;&lt;P&gt;h.definedone();&lt;/P&gt;&lt;P&gt;h.output(dataset:'want');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This one feels better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 20:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30105#M7101</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-13T20:18:51Z</dc:date>
    </item>
    <item>
      <title>how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30106#M7102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I may not have made myself clear enough:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;keep the first incidence of key&lt;/P&gt;&lt;P&gt;dcl hash h(dataset:'have', ordered:'a');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;keep the last incidence of key&lt;/P&gt;&lt;P&gt;dcl hash h(dataset:'have', ordered:'a' ,duplicate:'r');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;keep all incidience of key&lt;/P&gt;&lt;P&gt;dcl hash h(dataset:'have', ordered:'a' ,multidata:'y');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fail if duplicates of key exist in loading file&lt;/P&gt;&lt;P&gt;dcl hash h(dataset:'have', ordered:'a' ,duplicate:'e');&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 20:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30106#M7102</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-03-13T20:27:28Z</dc:date>
    </item>
    <item>
      <title>how to incorporate 'NODUPKEY' in hash?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30107#M7103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Learned and Agreed!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 20:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-incorporate-NODUPKEY-in-hash/m-p/30107#M7103</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-13T20:57:06Z</dc:date>
    </item>
  </channel>
</rss>

