<?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: create data set with only new/changed data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424350#M104493</link>
    <description>&lt;P&gt;How many variables are you looking at?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can look at PROC COMPARE to see if any of those output data set meet your needs, but I suspect you'll need to code your own to get exactly what you want. If you need further assistance it would probably be a good idea to show some sample data and what you want as output. THIS DOES NOT NEED TO BE YOUR ACTUAL DATA. It just needs to reflect how your data is structured and the complexities of the problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184572"&gt;@dhealth&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am trying to figure out how to approach a problem. I have a basic procedure that cleans and outputs a data set that we transfer to a partner organization. They have asked to change the procedure so that we only transmit lines of data that are new since the last transfer or older entries that have a change to 1 or more variable entries. I imagine I need to make create a comparison table each time I transmit so that the next data pull can compare back to it.&lt;/P&gt;
&lt;P&gt;What I don't know is how to write the code to compare for new or changed entries. Any help is appreciated!&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2018 16:06:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-01-02T16:06:39Z</dc:date>
    <item>
      <title>create data set with only new/changed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424341#M104491</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to figure out how to approach a problem. I have a basic procedure that cleans and outputs a data set that we transfer to a partner organization. They have asked to change the procedure so that we only transmit lines of data that are new since the last transfer or older entries that have a change to 1 or more variable entries. I imagine I need to make create a comparison table each time I transmit so that the next data pull can compare back to it.&lt;/P&gt;&lt;P&gt;What I don't know is how to write the code to compare for new or changed entries. Any help is appreciated!&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 15:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424341#M104491</guid>
      <dc:creator>dhealth</dc:creator>
      <dc:date>2018-01-02T15:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: create data set with only new/changed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424350#M104493</link>
      <description>&lt;P&gt;How many variables are you looking at?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can look at PROC COMPARE to see if any of those output data set meet your needs, but I suspect you'll need to code your own to get exactly what you want. If you need further assistance it would probably be a good idea to show some sample data and what you want as output. THIS DOES NOT NEED TO BE YOUR ACTUAL DATA. It just needs to reflect how your data is structured and the complexities of the problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184572"&gt;@dhealth&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am trying to figure out how to approach a problem. I have a basic procedure that cleans and outputs a data set that we transfer to a partner organization. They have asked to change the procedure so that we only transmit lines of data that are new since the last transfer or older entries that have a change to 1 or more variable entries. I imagine I need to make create a comparison table each time I transmit so that the next data pull can compare back to it.&lt;/P&gt;
&lt;P&gt;What I don't know is how to write the code to compare for new or changed entries. Any help is appreciated!&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 16:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424350#M104493</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-02T16:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: create data set with only new/changed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424352#M104495</link>
      <description>&lt;P&gt;It will be easy if you add a variable to the dataset, a flag of&amp;nbsp;NEW/OLD data.&lt;/P&gt;
&lt;P&gt;Each time you add or update an observation sign it as NEW.&lt;/P&gt;
&lt;P&gt;After sending the changes (flaged as NEW) update the flag to OLD in all observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to add a date variable of the last date sent to the partner, to each observation,&lt;/P&gt;
&lt;P&gt;that is the date of changingthe flag from&amp;nbsp; NEW to OLD.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 16:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424352#M104495</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-02T16:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: create data set with only new/changed data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424365#M104498</link>
      <description>&lt;P&gt;I like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;'s idea. If you have a last_modified date on your data set, which a lot of DB's have by default within a&amp;nbsp; data warehouse, you could use that. If you don't, you can kind of create your own.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How is your data modified/updated each time is a bit of the key question. Here's an example of how this could work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Original data set;
data class1; 
set sashelp.class;
last_update_date = '01Jan2017'd;
run;

*Changes;
data class2;
set sashelp.class;
last_update_date = '02Jan2017'd;
if age=13 then age=21;

else if height&amp;gt;65 then height= 100;
else delete;

run;


*sort for updates;
proc sort data=class1; by name;
proc sort data=class2; by name;run;

*update data set;
data class3;
update class1 class2;
by name;
run;

*find max date;
proc sql noprint;
create table changes as
select *
from class3
having last_update_date = max(last_update_date);
quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jan 2018 16:41:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-with-only-new-changed-data/m-p/424365#M104498</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-02T16:41:01Z</dc:date>
    </item>
  </channel>
</rss>

