<?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 Decode Hash Table Code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Decode-Hash-Table-Code/m-p/855018#M337952</link>
    <description>&lt;P&gt;I have the following code which I need to decode and will require the communities help to understand if my thinking is correct. Here's the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data facilities(index=(obk fack))&lt;BR /&gt;f_xclud&lt;BR /&gt;;&lt;BR /&gt;format arrival_dt_system last_dt date9.;&lt;BR /&gt;length cd_base_id $6. cm_ind_l2 $25.;&lt;BR /&gt;if _n_ eq 1 then do;&lt;BR /&gt;declare hash nai (dataset:"D_industry");&lt;BR /&gt;nai.definekey ('ind_gen_id');&lt;BR /&gt;nai.definedata ('cd_base_id','cm_ind_l2');&lt;BR /&gt;nai.definedone ();&lt;BR /&gt;call missing(cd_base_id, cm_ind_l2);&lt;BR /&gt;declare hash arv (dataset:"f_a_dt");&lt;BR /&gt;arv.definekey ('ps_o_id', 'ps_s_id ', 'ps_f_id');&lt;BR /&gt;arv.definedata ('arrival_dt_system', 'last_dt');&lt;BR /&gt;arv.definedone ();&lt;BR /&gt;call missing(arrival_dt_system, last_dt);&lt;BR /&gt;end;&lt;BR /&gt;merge&lt;BR /&gt;facs_sorted(in=from1)&lt;BR /&gt;f_lg_v(in=from2)&lt;BR /&gt;f_xclud(in=from3)&lt;BR /&gt;defaults(in=from4)&lt;BR /&gt;end = last_obs;&lt;BR /&gt;by ps_o_id ps_s_id ps_f_id period_dt;&lt;/P&gt;&lt;P&gt;rc = arv.find();&lt;BR /&gt;rc = nai.find();&lt;BR /&gt;drop rc;&lt;BR /&gt;if pd_e_flag EQ 'Y' then output f_xclud;&lt;BR /&gt;else output facilities;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My understanding:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its Creating a merged dataset from the 4 tables:&amp;nbsp;&lt;/P&gt;&lt;P&gt;facs_sorted(in=from1)&lt;BR /&gt;f_lg_v(in=from2)&lt;BR /&gt;f_xclud(in=from3)&lt;BR /&gt;defaults(in=from4)&amp;nbsp;&lt;/P&gt;&lt;P&gt;usinf the variables mentioned after "BY"&lt;/P&gt;&lt;P&gt;Then its left joining the merged table with the dataset mentioned under the two&amp;nbsp; hash object with their respective keys.&lt;/P&gt;&lt;P&gt;Finally its storing the output table based on the&amp;nbsp; variable&amp;nbsp;pd_e_flag&amp;nbsp; and its value,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if I am missing anything. TIA&lt;/P&gt;</description>
    <pubDate>Sun, 22 Jan 2023 19:32:50 GMT</pubDate>
    <dc:creator>rahulsaha2127</dc:creator>
    <dc:date>2023-01-22T19:32:50Z</dc:date>
    <item>
      <title>Decode Hash Table Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Decode-Hash-Table-Code/m-p/855018#M337952</link>
      <description>&lt;P&gt;I have the following code which I need to decode and will require the communities help to understand if my thinking is correct. Here's the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data facilities(index=(obk fack))&lt;BR /&gt;f_xclud&lt;BR /&gt;;&lt;BR /&gt;format arrival_dt_system last_dt date9.;&lt;BR /&gt;length cd_base_id $6. cm_ind_l2 $25.;&lt;BR /&gt;if _n_ eq 1 then do;&lt;BR /&gt;declare hash nai (dataset:"D_industry");&lt;BR /&gt;nai.definekey ('ind_gen_id');&lt;BR /&gt;nai.definedata ('cd_base_id','cm_ind_l2');&lt;BR /&gt;nai.definedone ();&lt;BR /&gt;call missing(cd_base_id, cm_ind_l2);&lt;BR /&gt;declare hash arv (dataset:"f_a_dt");&lt;BR /&gt;arv.definekey ('ps_o_id', 'ps_s_id ', 'ps_f_id');&lt;BR /&gt;arv.definedata ('arrival_dt_system', 'last_dt');&lt;BR /&gt;arv.definedone ();&lt;BR /&gt;call missing(arrival_dt_system, last_dt);&lt;BR /&gt;end;&lt;BR /&gt;merge&lt;BR /&gt;facs_sorted(in=from1)&lt;BR /&gt;f_lg_v(in=from2)&lt;BR /&gt;f_xclud(in=from3)&lt;BR /&gt;defaults(in=from4)&lt;BR /&gt;end = last_obs;&lt;BR /&gt;by ps_o_id ps_s_id ps_f_id period_dt;&lt;/P&gt;&lt;P&gt;rc = arv.find();&lt;BR /&gt;rc = nai.find();&lt;BR /&gt;drop rc;&lt;BR /&gt;if pd_e_flag EQ 'Y' then output f_xclud;&lt;BR /&gt;else output facilities;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My understanding:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its Creating a merged dataset from the 4 tables:&amp;nbsp;&lt;/P&gt;&lt;P&gt;facs_sorted(in=from1)&lt;BR /&gt;f_lg_v(in=from2)&lt;BR /&gt;f_xclud(in=from3)&lt;BR /&gt;defaults(in=from4)&amp;nbsp;&lt;/P&gt;&lt;P&gt;usinf the variables mentioned after "BY"&lt;/P&gt;&lt;P&gt;Then its left joining the merged table with the dataset mentioned under the two&amp;nbsp; hash object with their respective keys.&lt;/P&gt;&lt;P&gt;Finally its storing the output table based on the&amp;nbsp; variable&amp;nbsp;pd_e_flag&amp;nbsp; and its value,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if I am missing anything. TIA&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2023 19:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Decode-Hash-Table-Code/m-p/855018#M337952</guid>
      <dc:creator>rahulsaha2127</dc:creator>
      <dc:date>2023-01-22T19:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Decode Hash Table Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Decode-Hash-Table-Code/m-p/855039#M337956</link>
      <description>&lt;P&gt;You are right. The two hash objects perform a lookup without the need for additional sorting of the base datasets (the result of the 4-way merge).&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 06:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Decode-Hash-Table-Code/m-p/855039#M337956</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-23T06:29:26Z</dc:date>
    </item>
  </channel>
</rss>

