<?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 large table based another table key in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818668#M323147</link>
    <description>&lt;P&gt;You can try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Sort source tables first so you can do a Data Step Merge*/&lt;BR /&gt;proc sort data = ID_TABLE out=work.ID_TABLE;&lt;BR /&gt;by ID_ONE;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data = FULL_TABLE out=work.FULL_TABLE;&lt;BR /&gt;by ID_TWO;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Use the Data Step to merge and create desired output in a new table*/&lt;BR /&gt;data newtable;&lt;BR /&gt;merge work.ID_TABLE (IN=IT) work.FULL_TABLE(IN=FT RENAME=(ID_TWO=ID_ONE));&lt;BR /&gt;by ID_ONE;&lt;/P&gt;
&lt;P&gt;if IT = 1 and FT=1 then&lt;BR /&gt;do;&lt;BR /&gt;A1 = 'X';&lt;BR /&gt;B1 = 'X';&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 18:31:21 GMT</pubDate>
    <dc:creator>JOL</dc:creator>
    <dc:date>2022-06-16T18:31:21Z</dc:date>
    <item>
      <title>update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818661#M323145</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table called ID_TABLE that contains only IDs. ID_ONE is the name of the column.There is another table called FULL_TABLE which has an ID_TWO column and two other columns called A1 and B1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the value of the ID_ONE field is equal to the ID_TWO field, the value of fields A1 and B1 in the FULL_TABLE table must be overwritten with an 'X'.&lt;/P&gt;&lt;P&gt;Table A has about 30,000 rows. Table B has 40,000,000 rows.&lt;/P&gt;&lt;P&gt;How can this be solved with the best performance? Hash joinnal? Proc sql with very slow. The board itself should be overwritten.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 18:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818661#M323145</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2022-06-16T18:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818668#M323147</link>
      <description>&lt;P&gt;You can try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Sort source tables first so you can do a Data Step Merge*/&lt;BR /&gt;proc sort data = ID_TABLE out=work.ID_TABLE;&lt;BR /&gt;by ID_ONE;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data = FULL_TABLE out=work.FULL_TABLE;&lt;BR /&gt;by ID_TWO;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Use the Data Step to merge and create desired output in a new table*/&lt;BR /&gt;data newtable;&lt;BR /&gt;merge work.ID_TABLE (IN=IT) work.FULL_TABLE(IN=FT RENAME=(ID_TWO=ID_ONE));&lt;BR /&gt;by ID_ONE;&lt;/P&gt;
&lt;P&gt;if IT = 1 and FT=1 then&lt;BR /&gt;do;&lt;BR /&gt;A1 = 'X';&lt;BR /&gt;B1 = 'X';&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 18:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818668#M323147</guid>
      <dc:creator>JOL</dc:creator>
      <dc:date>2022-06-16T18:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818705#M323164</link>
      <description>&lt;P&gt;Hash object:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set b;
if _n_ = 1
then do;
  declare hash a (dataset:"a (rename=(id_one=id_two))");
  a.definekey("id_two");
  a.definedone();
end;
if a.check() = 0
then do;
  a1 = "X";
  b1 = "X";
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jun 2022 21:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818705#M323164</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-16T21:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818912#M323265</link>
      <description>&lt;P&gt;Thanks! That's exactly what I was thinking! I learned a lot from it. Do you know how I could extract from this hash update how many successful updates there were in the target table?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 18:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818912#M323265</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2022-06-17T18:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818925#M323271</link>
      <description>&lt;P&gt;Keep a running count, and store it in a macro variable for later use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set b end=done;
if _n_ = 1
then do;
  declare hash a (dataset:"a (rename=(id_one=id_two))");
  a.definekey("id_two");
  a.definedone();
end;
if a.check() = 0
then do;
  a1 = "X";
  b1 = "X";
  count + 1;
end;
if done
then do;
  put count=;
  call symputx('count',count);
end;
drop count;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jun 2022 20:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/818925#M323271</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-17T20:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/819227#M323392</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I want to update table' b' locally instead of 'want' table and there is an index on the 'b' table, will it be dropped or retained? So after the data there will be the ' b' table and after the set there will be also the 'b' table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 23:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/819227#M323392</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2022-06-20T23:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: update large table based another table key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/819898#M323611</link>
      <description>&lt;P&gt;After recreating a dataset, you must also recreate the index.&lt;/P&gt;
&lt;P&gt;Run this simple example and look at the print output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
run;

proc sql;
create index sex on work.class(sex);
quit;

proc datasets lib=work;
quit;

data class;
set class;
x = 1;
run;

proc datasets lib=work;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2022 07:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/update-large-table-based-another-table-key/m-p/819898#M323611</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-23T07:21:58Z</dc:date>
    </item>
  </channel>
</rss>

