<?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: Proc Append - add new data to a historic table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485427#M126122</link>
    <description>&lt;P&gt;proc append cannot delete data from the base dataset, it only adds new data to the (physical) end of the base dataset.&lt;/P&gt;
&lt;P&gt;Please supply some example data (see my footnotes) to illustrate how you would want to handle the delete's.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Aug 2018 11:35:17 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-09T11:35:17Z</dc:date>
    <item>
      <title>Proc Append - add new data to a historic table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485425#M126120</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I have two tables, one of them is a historical table (Table 1) that I am storing all data in, the other is a table that updates with new data and deletes old data that is no longer needed (Table 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wanting to take the new data from Table 2 and add it on to Table 1, what is the easiest way to do this? I will be able to identify the new data as there is a field that identifies new data going in, so the data goes in in batches and I have the name of the new batches going in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is Proc Append the best thing in this situation?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 11:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485425#M126120</guid>
      <dc:creator>Symun23</dc:creator>
      <dc:date>2018-08-09T11:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Append - add new data to a historic table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485427#M126122</link>
      <description>&lt;P&gt;proc append cannot delete data from the base dataset, it only adds new data to the (physical) end of the base dataset.&lt;/P&gt;
&lt;P&gt;Please supply some example data (see my footnotes) to illustrate how you would want to handle the delete's.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 11:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485427#M126122</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-09T11:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Append - add new data to a historic table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485428#M126123</link>
      <description>Thats fine, I am not wanting to delete anything, just want to add the new data from Table 2 and add it on to the end of Table 1</description>
      <pubDate>Thu, 09 Aug 2018 11:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485428#M126123</guid>
      <dc:creator>Symun23</dc:creator>
      <dc:date>2018-08-09T11:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Append - add new data to a historic table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485429#M126124</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221450"&gt;@Symun23&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thats fine, I am not wanting to delete anything, just want to add the new data from Table 2 and add it on to the end of Table 1&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then use proc append. Keep in mind that you need exclusive access to the base dataset while appending (no process may have the dataset opened).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 11:48:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485429#M126124</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-09T11:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Append - add new data to a historic table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485449#M126129</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC APPEND might not work for you, because when you have extra variable in data=table2 that are not in base=table1 FORCE option concatenates and drops the extra variables. Missing values will be assigned to variables that are in base=table1 but not in data=table2. I suggest you using proc sql set operator OUTER UNION CORR or Data step SET statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you are using PROC APPEND with FORCE keep in mind that dropping/truncating might occur.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check PROC APPEND vs OUTER UNION vs SET statement results here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data allvars;
  set sashelp.class (obs=5);
run;

data onevar (keep= name_ age);
  set sashelp.class (obs=5 rename=(name=name_));
run;
 
proc append base=onevar data=allvars force ;
run;

proc print data=onevar;
run;

proc sql;
create table allvars_ as
select * from allvars
outer union corr
select * from onevar;
quit;

data allvars;
set allvars onevar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 12:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Append-add-new-data-to-a-historic-table/m-p/485449#M126129</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-08-09T12:58:05Z</dc:date>
    </item>
  </channel>
</rss>

