<?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 Merging tables with same columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674318#M203038</link>
    <description>&lt;P&gt;Dear SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help to merge two tables with same columns. To be more precise, I have two tables one very large(more than 200 columns and about 6000 rows) and second tables with same columns and just one row. I need to impute values from second table in missing field in first table.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Table 1&lt;/P&gt;&lt;P&gt;A1 A2 A3 A4 A5 ....&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; 6.7&amp;nbsp; 1&amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2&lt;/P&gt;&lt;P&gt;A1 A2 A3 A4 A5 ...&lt;/P&gt;&lt;P&gt;2.4&amp;nbsp; 6.5 5&amp;nbsp; 2.8&amp;nbsp; 1.7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;A1&amp;nbsp; A2&amp;nbsp; &amp;nbsp;A3&amp;nbsp; &amp;nbsp;A4&amp;nbsp; &amp;nbsp; &amp;nbsp;A5 ....&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp;6.7&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF6600"&gt;2.8&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;2.4&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp;&lt;FONT color="#FF6600"&gt; &amp;nbsp;5&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF6600"&gt;1.7&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to set keys for merging as arrays?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 04 Aug 2020 11:51:38 GMT</pubDate>
    <dc:creator>miner_girl</dc:creator>
    <dc:date>2020-08-04T11:51:38Z</dc:date>
    <item>
      <title>Merging tables with same columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674318#M203038</link>
      <description>&lt;P&gt;Dear SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help to merge two tables with same columns. To be more precise, I have two tables one very large(more than 200 columns and about 6000 rows) and second tables with same columns and just one row. I need to impute values from second table in missing field in first table.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Table 1&lt;/P&gt;&lt;P&gt;A1 A2 A3 A4 A5 ....&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; 6.7&amp;nbsp; 1&amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2&lt;/P&gt;&lt;P&gt;A1 A2 A3 A4 A5 ...&lt;/P&gt;&lt;P&gt;2.4&amp;nbsp; 6.5 5&amp;nbsp; 2.8&amp;nbsp; 1.7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;A1&amp;nbsp; A2&amp;nbsp; &amp;nbsp;A3&amp;nbsp; &amp;nbsp;A4&amp;nbsp; &amp;nbsp; &amp;nbsp;A5 ....&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp;6.7&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF6600"&gt;2.8&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;2.4&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp;&lt;FONT color="#FF6600"&gt; &amp;nbsp;5&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF6600"&gt;1.7&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to set keys for merging as arrays?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 11:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674318#M203038</guid>
      <dc:creator>miner_girl</dc:creator>
      <dc:date>2020-08-04T11:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Merging tables with same columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674329#M203044</link>
      <description>&lt;P&gt;My idea: create a SQL step dynamically from SASHELP.VCOLUMN:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
input A1 A2 A3 A4 A5;
datalines;
5    6.7  1   .   2
.      2    .    3   .
;

data have2;
input A1 A2 A3 A4 A5;
datalines;
2.4  6.5 5  2.8  1.7
;

data _null_;
set sashelp.vcolumn (where=(libname ="WORK" and memname = "HAVE1")) end=done;
if _n_ = 1 then call execute("
proc sql;
create table want as
  select
");
call execute("coalesce(h1." !! strip(name) !! ",h2." !! strip(name) !! ") as " !! strip(name));
if done then call execute("
from have1 h1, have2 h2;
quit;
");
else call execute(",");
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 12:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674329#M203044</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-04T12:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Merging tables with same columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674339#M203053</link>
      <description>&lt;PRE&gt;data have1;
input A1 A2 A3 A4 A5;
datalines;
5    6.7  1   .   2
.      2    .    3   .
;

data have2;
input A1 A2 A3 A4 A5;
datalines;
2.4  6.5 5  2.8  1.7
;

data a;
 set have1 end=last;
 id+1;
 if last then call symputx('n',_n_);
run;
data b;
 set have2;
 do id=1 to &amp;amp;n;
  output;
 end;
run;

data want;
 update b a;
 by id;
 drop id;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 12:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-tables-with-same-columns/m-p/674339#M203053</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-08-04T12:48:44Z</dc:date>
    </item>
  </channel>
</rss>

