<?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: Convert Hash Table code to SQL in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854733#M337818</link>
    <description>&lt;P&gt;The SAS hash object / Table is available in a data step only.&lt;BR /&gt;While one can always Proc SQL to join two tables to get an identical outcome, the two process work differently .&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2023 03:54:30 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2023-01-20T03:54:30Z</dc:date>
    <item>
      <title>Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854678#M337800</link>
      <description>&lt;P&gt;I have a code leveraging SAS Hash Tables for join and I want to create&amp;nbsp; the same table using Procedure SQL.&lt;/P&gt;&lt;P&gt;Here is the following HASH Table code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data tem_excludes;&lt;BR /&gt;if _n_ eq 1 then do;&lt;BR /&gt;declare hash sec (dataset:"d_sec_list");&lt;BR /&gt;sec.definekey ('curr_obr_num', 'sys', 'fc_num');&lt;BR /&gt;sec.definedata ('secure_exclusion');&lt;BR /&gt;sec.definedone ();&lt;BR /&gt;call missing(secure_exclusion);&lt;BR /&gt;declare hash sng (dataset:"single_entry");&lt;BR /&gt;sng.definekey ('fackey');&lt;BR /&gt;sng.definedata ('count');&lt;BR /&gt;sng.definedone ();&lt;BR /&gt;call missing(count);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;set tem_exclude0;&lt;BR /&gt;rc = sec.find();&lt;BR /&gt;rc = sng.find();&lt;/P&gt;&lt;P&gt;if secure_exclusion then p_flag= 'Y';&lt;BR /&gt;if count EQ 1 then do;&lt;BR /&gt;p_flag= 'Y';&lt;BR /&gt;single_entry = 1;&lt;BR /&gt;end;&lt;BR /&gt;else single_entry = 0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would need to write an equivalent code using Proc sql without any hash table.&lt;/P&gt;&lt;P&gt;Please share your inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 19:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854678#M337800</guid>
      <dc:creator>rahulsaha2127</dc:creator>
      <dc:date>2023-01-19T19:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854679#M337801</link>
      <description>&lt;P&gt;There's no equivalent in SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 19:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854679#M337801</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-01-19T19:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854683#M337803</link>
      <description>&lt;P&gt;There is no direct equvalent i Proc SQL. However, this should get you some of the way with the lookup / join part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

   create table tem_excludes as
   
   select a.*
        , b.secure_exclusion
		, c.count
		
   from tem_exclude0 as a
   
   left join d_sec_list as b
   on  a.curr_obr_num = b.curr_obr_num
   and a.sys          = b.sys
   and a.fc_num       = b.fc_num
   
   left join single_entry as c
   on a.fackey = c.fackey
   
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 19:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854683#M337803</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-01-19T19:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854733#M337818</link>
      <description>&lt;P&gt;The SAS hash object / Table is available in a data step only.&lt;BR /&gt;While one can always Proc SQL to join two tables to get an identical outcome, the two process work differently .&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 03:54:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854733#M337818</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2023-01-20T03:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854769#M337832</link>
      <description>After the join using the hash table for which you have provided the sql alternative, what is the code exactly trying to do? Is it creating new variables on the newly created dataset tem_excludes?&lt;BR /&gt;Am referring to this part:&lt;BR /&gt;if secure_exclusion then p_flag= 'Y';&lt;BR /&gt;if count EQ 1 then do;&lt;BR /&gt;p_flag= 'Y';&lt;BR /&gt;single_entry = 1;&lt;BR /&gt;end;&lt;BR /&gt;else single_entry = 0;&lt;BR /&gt;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 20 Jan 2023 08:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854769#M337832</guid>
      <dc:creator>rahulsaha2127</dc:creator>
      <dc:date>2023-01-20T08:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854770#M337833</link>
      <description>&lt;P&gt;Given that you have working code - why?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 08:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854770#M337833</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-01-20T08:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Hash Table code to SQL in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854776#M337835</link>
      <description>&lt;P&gt;Hash objects are typically used to MASSIVELY speed up a join process. Converting this to SQL code will probably end up with you watching the paint dry or the grass grow.&lt;/P&gt;
&lt;P&gt;Don't do it, unless you&amp;nbsp;&lt;U&gt;must&lt;/U&gt; because the hash objects cause a memory overflow.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 08:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Hash-Table-code-to-SQL-in-SAS/m-p/854776#M337835</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-20T08:57:54Z</dc:date>
    </item>
  </channel>
</rss>

