<?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 Logic Example in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490542#M128355</link>
    <description>&lt;P&gt;Use the format approach I gave you in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Hash-or-Array-solution/m-p/489950" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Hash-or-Array-solution/m-p/489950&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It only needs one pass through the large dataset, so it's best performance- and resourcewise. And easier to understand and maintain than a hash.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2018 16:18:16 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-28T16:18:16Z</dc:date>
    <item>
      <title>Hash Logic Example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490474#M128323</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some guidelines to proceed with my requirement. Here are the details:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#1)&amp;nbsp; I have a input txt file data as below:-&lt;/P&gt;&lt;P&gt;Row1 --&amp;gt;123456 Transact1 Transact2 Transact3&lt;/P&gt;&lt;P&gt;Row2--&amp;gt; 456789 Transac1&amp;nbsp; Transact2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#2) I have queried from database and created another dataset 'Details' with below values:-&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TransactionType&amp;nbsp; Service&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Transact1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Transact2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A2&lt;/P&gt;&lt;P&gt;Transact3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to compare&amp;nbsp; #1 and #2 datasets to determine the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Service&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for each transactions for the employee&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we determined the service ,I have to output the data to different fles:-&lt;/P&gt;&lt;P&gt;If service is A1 then output to File1&lt;/P&gt;&lt;P&gt;If service is A2 then output to File2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please someone guide me on the &lt;STRONG&gt;SAS Hash Logic&lt;/STRONG&gt; functionality for this requirement ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help .&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490474#M128323</guid>
      <dc:creator>AshokD</dc:creator>
      <dc:date>2018-08-28T14:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Logic Example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490496#M128332</link>
      <description>&lt;P&gt;Can you show what you've tried so far?&lt;/P&gt;
&lt;P&gt;And provide sample data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's a tutorial here on Hash and you can find many more on lexjansen.com&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/pharmasug/2011/TT/PharmaSUG-2011-TT15.pdf" target="_blank"&gt;https://www.lexjansen.com/pharmasug/2011/TT/PharmaSUG-2011-TT15.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490496#M128332</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-28T14:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Logic Example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490497#M128333</link>
      <description>&lt;P&gt;What defines an employee? Do you need help importing the .txt file into SAS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please be more specific about what you want your desired result to look like.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490497#M128333</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-28T14:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Logic Example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490542#M128355</link>
      <description>&lt;P&gt;Use the format approach I gave you in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Hash-or-Array-solution/m-p/489950" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Hash-or-Array-solution/m-p/489950&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It only needs one pass through the large dataset, so it's best performance- and resourcewise. And easier to understand and maintain than a hash.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490542#M128355</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-28T16:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Logic Example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490545#M128357</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the details:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Dataset A:-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EmployeeID&amp;nbsp; Transactiontype&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Transact1&lt;/P&gt;&lt;P&gt;345678&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Transact2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;678903&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Transact3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Dataset B:-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EmployeeID TransactionType&amp;nbsp; Service&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Transact1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;345678&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Transact2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A2&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;678903&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Transact3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to compare&amp;nbsp; A and B datasets to determine the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Service&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for each transactions for the employeeIDs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we determined the service ,I have to output the data to different fles:-&lt;/P&gt;&lt;P&gt;If service is A1 then output to File1&lt;/P&gt;&lt;P&gt;If service is A2 then output to File2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Logic I have tried it:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data FILE1 FILE2;&lt;BR /&gt;&lt;BR /&gt;if _N_ = 1 then do;&lt;BR /&gt;&lt;BR /&gt;declare hash h(dataset: "B")&lt;BR /&gt;&lt;BR /&gt;h.defineKey('&lt;STRONG&gt;EmployeeID&lt;/STRONG&gt;');&lt;BR /&gt;h.defineData('&lt;STRONG&gt;TransactionType&lt;/STRONG&gt;','&lt;STRONG&gt;Service&amp;nbsp;&lt;/STRONG&gt;');&lt;BR /&gt;h.defineDone();&lt;BR /&gt;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set A;&lt;BR /&gt;rc = h.find();&lt;BR /&gt;if (rc = 0) then do;&lt;BR /&gt;if Service ='A1' then output FILE1;&lt;BR /&gt;else if &lt;SPAN&gt;Service ='A2' then output FILE2&lt;/SPAN&gt;;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please have look , correct me if I am wrong anywhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490545#M128357</guid>
      <dc:creator>AshokD</dc:creator>
      <dc:date>2018-08-28T16:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Logic Example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490546#M128358</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the details:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Dataset A:-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EmployeeID&amp;nbsp; Transactiontype&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Transact1&lt;/P&gt;&lt;P&gt;345678&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Transact2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;678903&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Transact3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Dataset B:-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EmployeeID TransactionType&amp;nbsp; Service&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Transact1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;345678&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Transact2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A2&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;678903&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Transact3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to compare&amp;nbsp; A and B datasets to determine the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Service&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for each transactions for the employeeIDs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we determined the service ,I have to output the data to different fles:-&lt;/P&gt;&lt;P&gt;If service is A1 then output to File1&lt;/P&gt;&lt;P&gt;If service is A2 then output to File2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Logic I have tried it:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data FILE1 FILE2;&lt;BR /&gt;&lt;BR /&gt;if _N_ = 1 then do;&lt;BR /&gt;&lt;BR /&gt;declare hash h(dataset: "B")&lt;BR /&gt;&lt;BR /&gt;h.defineKey('&lt;STRONG&gt;EmployeeID&lt;/STRONG&gt;');&lt;BR /&gt;h.defineData('&lt;STRONG&gt;TransactionType&lt;/STRONG&gt;','&lt;STRONG&gt;Service&amp;nbsp;&lt;/STRONG&gt;');&lt;BR /&gt;h.defineDone();&lt;BR /&gt;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set A;&lt;BR /&gt;rc = h.find();&lt;BR /&gt;if (rc = 0) then do;&lt;BR /&gt;if Service ='A1' then output FILE1;&lt;BR /&gt;else if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Service ='A2' then output FILE2&lt;/SPAN&gt;;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please have a look , provide your suggestion&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Logic-Example/m-p/490546#M128358</guid>
      <dc:creator>AshokD</dc:creator>
      <dc:date>2018-08-28T16:22:45Z</dc:date>
    </item>
  </channel>
</rss>

