<?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: update 0,4 mln rekords in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839975#M332113</link>
    <description>Thanks for the answer, it's always nice to get to know something new.</description>
    <pubDate>Fri, 21 Oct 2022 16:22:00 GMT</pubDate>
    <dc:creator>Jacek2</dc:creator>
    <dc:date>2022-10-21T16:22:00Z</dc:date>
    <item>
      <title>update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839895#M332068</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;I have table wsad with 1,6 mln obs and table limit with 0,4 mln obs.&lt;BR /&gt;the code below works with several hundred records, but freezes on more&lt;BR /&gt;What to do to make it work with more records?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql; 
update WSAD as a 
set pkt = (select pkt from limit b where a.id= b.id),
     data = (select data from limit b where a.id = b.id)
 where a.id in (select id from limit);
 quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 11:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839895#M332068</guid>
      <dc:creator>Jacek2</dc:creator>
      <dc:date>2022-10-21T11:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839909#M332078</link>
      <description>&lt;P&gt;From your code, I guess that id is unique in both datasets.&lt;/P&gt;
&lt;P&gt;This should be much faster:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=wsad;
by id;
run;

proc sort data=limit;
by id;
run;

data want;
update
  wsad
  limit (keep=id pkt data)
;
by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS sub-selects are notoriously slow in SAS SQL.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 12:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839909#M332078</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-21T12:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839916#M332081</link>
      <description>Thank you Kurt, it works great and very fast !!!</description>
      <pubDate>Fri, 21 Oct 2022 12:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839916#M332081</guid>
      <dc:creator>Jacek2</dc:creator>
      <dc:date>2022-10-21T12:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839917#M332082</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/427324"&gt;@Jacek2&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is a requirement to edit dataset WSAD &lt;EM&gt;in place&lt;/EM&gt;&amp;nbsp;(which is what your original code does) and you want to avoid sorting, you can use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n0g9jfr4x5hgsfn17gtma5547lt1.htm" target="_blank" rel="noopener"&gt;MODIFY statement&lt;/A&gt;&amp;nbsp;of the DATA step together with a hash object:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wsad;
if _n_=1 then do;
  dcl hash h(dataset:'limit');
  h.definekey('id');
  h.definedata('pkt','data');
  h.definedone();
end;
modify wsad;
if h.find()=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 12:48:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839917#M332082</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-10-21T12:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839975#M332113</link>
      <description>Thanks for the answer, it's always nice to get to know something new.</description>
      <pubDate>Fri, 21 Oct 2022 16:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839975#M332113</guid>
      <dc:creator>Jacek2</dc:creator>
      <dc:date>2022-10-21T16:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839984#M332118</link>
      <description>What if there is no need to edit?</description>
      <pubDate>Fri, 21 Oct 2022 17:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/839984#M332118</guid>
      <dc:creator>Jacek2</dc:creator>
      <dc:date>2022-10-21T17:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: update 0,4 mln rekords</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/840004#M332134</link>
      <description>&lt;P&gt;If you don't mind overwriting WSAD with the updated version, but you still want&amp;nbsp;&lt;SPAN&gt;to avoid sorting, you can replace these two lines&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;modify wsad;
if h.find()=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;by these three&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set wsad;
rc=h.find();
drop rc;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;in my code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 19:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-0-4-mln-rekords/m-p/840004#M332134</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-10-21T19:02:46Z</dc:date>
    </item>
  </channel>
</rss>

