<?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: Looking forward to determine behaviour in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212117#M52388</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply xia.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I find that this solution works if it only looks 1 record ahead, but if the data had more purchases, how would i be able to capture whether each non preferred product has a later corresponding 'preferred' product?&lt;/P&gt;&lt;P&gt;for example: a patient may have purchased 3 alternatives to 456. &lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-01-01 123&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-02-01 456&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-03-01 222&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-04-01 333&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-01 335&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-12 456&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-15 334&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jun 2015 16:09:53 GMT</pubDate>
    <dc:creator>DangIT</dc:creator>
    <dc:date>2015-06-23T16:09:53Z</dc:date>
    <item>
      <title>Hash tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212115#M52386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table of claims data by ID and medical condition.&lt;/P&gt;&lt;P&gt;ID MC ServiceDate ProductID&lt;/P&gt;&lt;P&gt;1 ABC 2014-01-01 123&lt;/P&gt;&lt;P&gt;1 DEF 2014-02-01 456&lt;/P&gt;&lt;P&gt;1 ABC 2014-03-01 222&lt;/P&gt;&lt;P&gt;1 DEF 2014-04-01 333&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have a mapping table where ProductID is mapped to multiple 'preferred' products&lt;/P&gt;&lt;P&gt;NP_ProductID Preferred_ProductID&lt;/P&gt;&lt;P&gt;123 222&lt;/P&gt;&lt;P&gt;123 223&lt;/P&gt;&lt;P&gt;123 224&lt;/P&gt;&lt;P&gt;456 333&lt;/P&gt;&lt;P&gt;456 334&lt;/P&gt;&lt;P&gt;456 335&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;The objective is to understand whether a patient is switching to a 'preferred' product.&lt;/P&gt;&lt;P&gt;I am&amp;nbsp; having troubles trying to figure how to 'look up' whether a patient takes a preferred product at a later period in their data and count it as a switch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output table I am trying to achieve is:&lt;/P&gt;&lt;P&gt;ID MC Switch_Cnt&lt;/P&gt;&lt;P&gt;1 ABC 1&lt;/P&gt;&lt;P&gt;1 DEF 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the approach is to use a hash table, but I am having troubles figuring out the logic and code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 13:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212115#M52386</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-06-23T13:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Looking forward to determine behaviour</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212116#M52387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H3&gt;Code: Program&lt;/H3&gt;&lt;DIV class="sce-html-export" style="font-family: 'Courier New', Menlo, 'Lucida Console';"&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-01-01 123&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-02-01 456&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-03-01 222&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-04-01 333&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;NP_ProductID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Preferred_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 222&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 223&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 224&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 333&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 334&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 335&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;sort&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;temp&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;merge&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;firstobs&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;keep&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;rename&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;_MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;want&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;_n_&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;eq&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;declare&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;hash&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;h&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;dataset&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'map'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;h.definekey&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'NP_ProductID'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'Preferred_ProductID'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;h.definedone&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;temp&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;first.MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;_MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;and&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;h.check&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;key&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;key&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;last.MC&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;keep&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 15:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212116#M52387</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-23T15:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Looking forward to determine behaviour</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212117#M52388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply xia.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I find that this solution works if it only looks 1 record ahead, but if the data had more purchases, how would i be able to capture whether each non preferred product has a later corresponding 'preferred' product?&lt;/P&gt;&lt;P&gt;for example: a patient may have purchased 3 alternatives to 456. &lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-01-01 123&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-02-01 456&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-03-01 222&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-04-01 333&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-01 335&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-12 456&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-15 334&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 16:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212117#M52388</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-06-23T16:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looking forward to determine behaviour</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212118#M52389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or another approach i'm trying to work through, is a 3 way lookup:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;NonPrefProducts&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-01-01 123&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-02-01 456&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-12 456&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;PrefProducts&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-03-01 222&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-04-01 333&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-01 335&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-15 334&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;NP_ProductID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Preferred_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 222&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 223&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 224&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 333&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 334&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 335&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;In the nonPrefProduct table, i'd need to look up whether each ID-MC made a claim for a PrefProduct at a later Service Date AND is valid mapping.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="sep" style="color: black;"&gt;I'm stuck on the coding of this.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 16:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212118#M52389</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-06-23T16:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Hash tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212119#M52390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will get you the solution you are looking for without a Hash Table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have1;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;informat servicedate yymmdd10.;&lt;/P&gt;&lt;P&gt;format servicedate mmddyy10.;&lt;/P&gt;&lt;P&gt;input ID$ MC$ ServiceDate ProductID$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 ABC 2014-01-01 123&lt;/P&gt;&lt;P&gt;1 DEF 2014-02-01 456&lt;/P&gt;&lt;P&gt;1 ABC 2014-03-01 222&lt;/P&gt;&lt;P&gt;1 DEF 2014-04-01 333&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have2;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;input NP_ProductID$ Preferred_ProductID$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;123 222&lt;/P&gt;&lt;P&gt;123 223&lt;/P&gt;&lt;P&gt;123 224&lt;/P&gt;&lt;P&gt;456 333&lt;/P&gt;&lt;P&gt;456 334&lt;/P&gt;&lt;P&gt;456 335&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select id,mc,1 as Switch_Cnt&lt;/P&gt;&lt;P&gt;from have1&lt;/P&gt;&lt;P&gt;where productid in &lt;/P&gt;&lt;P&gt;(select preferred_productid&lt;/P&gt;&lt;P&gt;from have2);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 16:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212119#M52390</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-06-23T16:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Hash tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212120#M52391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Mark. &lt;BR /&gt;Unfortunately the solution doesn't work in my case.&lt;/P&gt;&lt;P&gt;The mapping table may map multiple non preferred product to a single preferred product, there is a 1: many relationship that does not allow that solution to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 17:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212120#M52391</guid>
      <dc:creator>DangIT</dc:creator>
      <dc:date>2015-06-23T17:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Hash tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212121#M52392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can be done with a three-way join:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table switches as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select a.ID, a.MC, a.productID as from_productID, c.productID as to_productID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; have as a inner join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map as b on a.productID=b.NP_productID inner join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; have as c on a.id=c.id and a.MC=c.MC and &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.&lt;/STRONG&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;serviceDate&amp;lt;c.serviceDate and b.preferred_productID=c.productID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;order by ID, MC, from_productID, to_productID;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select * from switches;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you get the list of product switches, It is only a matter of counting whatever you want to count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 17:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212121#M52392</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-06-23T17:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Looking forward to determine behaviour</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212122#M52393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you want check all the combination of ProductID&amp;nbsp; not just the next ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3 style="color: #353535; font-family: Lato, sans-serif; background-color: #f0f1f2;"&gt;Code: Program&lt;/H3&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;format&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="format" style="color: #008080;"&gt;yymmdd10.&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-01-01 123&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-02-01 456&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 ABC 2014-03-01 222&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-04-01 333&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-01 335&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-12 456&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;1 DEF 2014-05-15 334&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;NP_ProductID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Preferred_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 222&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 223&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;123 224&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 333&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 334&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;456 335&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;sort&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ServiceDate&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;want&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;_n_&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;eq&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;declare&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;hash&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;h&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;dataset&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'map'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;h.definekey&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'NP_ProductID'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'Preferred_ProductID'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;h.definedone&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;array&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;99999&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;_temporary_&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;first.MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;last.MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;i&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;to&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;-&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;do&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;j&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;i&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;to&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;NP_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;i&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;Preferred_ProductID&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;{&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;j&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;h.check&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;+&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;keep&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;MC&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 12:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Hash-tables/m-p/212122#M52393</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-24T12:45:25Z</dc:date>
    </item>
  </channel>
</rss>

