<?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 this code is taking lot of time in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812923#M34068</link>
    <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table req_nw_rnw as &lt;BR /&gt;Select a.*&lt;BR /&gt;from si_yr a&lt;BR /&gt;where a.policy_no in (select b.Policy_no from si b where a.Policy_no=b.Policy_no&lt;BR /&gt;&lt;BR /&gt;and A.SI = B.SI)&lt;BR /&gt;order by Policy_no ;&lt;BR /&gt;quit ;&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2022 12:09:41 GMT</pubDate>
    <dc:creator>aanan1417</dc:creator>
    <dc:date>2022-05-12T12:09:41Z</dc:date>
    <item>
      <title>this code is taking lot of time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812923#M34068</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table req_nw_rnw as &lt;BR /&gt;Select a.*&lt;BR /&gt;from si_yr a&lt;BR /&gt;where a.policy_no in (select b.Policy_no from si b where a.Policy_no=b.Policy_no&lt;BR /&gt;&lt;BR /&gt;and A.SI = B.SI)&lt;BR /&gt;order by Policy_no ;&lt;BR /&gt;quit ;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 12:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812923#M34068</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2022-05-12T12:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: this code is taking lot of time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812925#M34069</link>
      <description>&lt;P&gt;Sub-selects are notoriously slow in SAS PROC SQL.&lt;/P&gt;
&lt;P&gt;For a simple lookup on two key variables, use a hash in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data req_nw_rnw;
set si_yr;
if _n_ = 1
then do;
  declare hash si (dataset:"si");
  si.definekey("policy_no","si");
  si.definedone();
end;
if si.check() = 0;
run;

proc sort data=req_nw_rnw;
by policy_no;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The final sort is only necessary if si_yr is not already sorted.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 12:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812925#M34069</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-12T12:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: this code is taking lot of time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812997#M34080</link>
      <description>&lt;P&gt;Just MERGE the datasets.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data req_nw_rnw;
  merge si_yr(in=in1) si_b(in=in2);
  by policy_no SI;
  if in1 and in2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 May 2022 14:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812997#M34080</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-12T14:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: this code is taking lot of time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812999#M34081</link>
      <description>608        data req_nw_rnw;&lt;BR /&gt;609        set si_yr;&lt;BR /&gt;610        if _n_ = 1&lt;BR /&gt;611        then do;&lt;BR /&gt;612          declare hash si (dataset:"si");&lt;BR /&gt;                             _&lt;BR /&gt;                             567&lt;BR /&gt;613          si.definekey("policy_no","si");&lt;BR /&gt;             ____________&lt;BR /&gt;             557&lt;BR /&gt;ERROR: DATA STEP Component Object failure.  Aborted during the COMPILATION phase.&lt;BR /&gt;ERROR 567-185: Variable SI already defined.&lt;BR /&gt;&lt;BR /&gt;ERROR 557-185: Variable si is not an object.&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;      real time           0.00 seconds&lt;BR /&gt;      cpu time            0.00 seconds&lt;BR /&gt;      &lt;BR /&gt;614          si.definedone();&lt;BR /&gt;615        end;&lt;BR /&gt;616        if si.check() = 0;&lt;BR /&gt;617        run;&lt;BR /&gt;618</description>
      <pubDate>Thu, 12 May 2022 15:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/812999#M34081</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2022-05-12T15:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: this code is taking lot of time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/813137#M34097</link>
      <description>&lt;P&gt;My bad; you cannot name a hash object with the name of a variable which is already defined (through the SET statement).&lt;/P&gt;
&lt;P&gt;Let's reduce the name of the hash to a single character:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data req_nw_rnw;
set si_yr;
if _n_ = 1
then do;
  declare hash s (dataset:"si");
  s.definekey("policy_no","si");
  s.definedone();
end;
if s.check() = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should work unless you also have a variable s in your dataset,&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 08:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/this-code-is-taking-lot-of-time/m-p/813137#M34097</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-13T08:00:33Z</dc:date>
    </item>
  </channel>
</rss>

