<?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: Delta File in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155872#M30484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;The master data set should have only one value or combination of the key values though.&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;The transaction data can have multiples, but not the master table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jun 2014 17:56:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-06-30T17:56:39Z</dc:date>
    <item>
      <title>Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155865#M30477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good Afternoon, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have generated a report, the data comes from a vendor that will send a file whenever there is an update with only records that have been updated.&amp;nbsp; I have a solution that works as far as I can tell, I want to update the existing file with only things that have changed.&amp;nbsp; Attached is my solution.&amp;nbsp; I know this is a common situation and I wanted to put this out here to get opinions, and hopefully find a better solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 18:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155865#M30477</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2014-06-25T18:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155866#M30478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your have a classic base data and transaction data set update;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data updata;&lt;/P&gt;&lt;P&gt; update data delta;&lt;/P&gt;&lt;P&gt; by empid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 19:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155866#M30478</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-06-25T19:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155867#M30479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to understand in a better way. Why you need this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=compare;by empid descending period;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;set compare;&lt;/P&gt;&lt;P&gt;by empid;&lt;/P&gt;&lt;P&gt;if first.empid then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 20:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155867#M30479</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-25T20:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155868#M30480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added this to make sure I was only pulling the most recent record.&amp;nbsp; For the real datasets I'm using there will be a datestamp.&amp;nbsp; I just added period to sort by the most recent record.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 14:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155868#M30480</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2014-06-30T14:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155869#M30481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In delta file there is only one observation (if updated) for each empid in addition to new empids right?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 15:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155869#M30481</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-30T15:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155870#M30482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the transaction file has multiple records for the same empid then ALL of them are applied.&lt;/P&gt;&lt;P&gt;This is actually a good behavior because not all of the variables may necessarily update at the same time.&lt;/P&gt;&lt;P&gt;It may be easier to see what happens with single records but not required. The master data set should have only one value or combination of the key values though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 16:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155870#M30482</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-06-30T16:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155871#M30483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the input &lt;SPAN class="j-status-levels"&gt; &lt;/SPAN&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="260198" data-username="ballardw" href="https://communities.sas.com/people/ballardw" id="jive-26019819527093220500186"&gt;ballardw&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;. Just trying to understand how update works. Please see below syntax where empid=3124 appears twice and only first observation in the sequence is updated with delta observation in transaction data while other remains the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data transaction;&lt;/P&gt;&lt;P&gt;input empid $ one two three four five period;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1234 1 2 3 4 5 1&lt;/P&gt;&lt;P&gt;2134 2 1 3 4 5 1&lt;/P&gt;&lt;P&gt;3124 3 2 1 4 5 1&lt;/P&gt;&lt;P&gt;3124 4 2 1 4 5 1&lt;/P&gt;&lt;P&gt;4123 4 3 2 1 5 1&lt;/P&gt;&lt;P&gt;5123 5 4 3 2 1 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data delta;&lt;/P&gt;&lt;P&gt;input empid $ one two three four five period;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;3124 5 5 5 5 5 2&lt;/P&gt;&lt;P&gt;6666 1 1 1 1 1 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data updata;&lt;/P&gt;&lt;P&gt; update transaction delta;&lt;/P&gt;&lt;P&gt; by empid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=updata;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 17:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155871#M30483</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-30T17:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155872#M30484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;The master data set should have only one value or combination of the key values though.&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;The transaction data can have multiples, but not the master table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 17:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155872#M30484</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-30T17:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155873#M30485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reza - I've only one value in master data set (delta) for empid=3124 and two observations for empid=3124 in transaction table but it updates the first observation in transaction data only. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 18:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155873#M30485</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-30T18:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155874#M30486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;data updata;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;update transaction delta;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;by empid;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc print data=updata;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The MASTER Table as SAS knows it is called transaction. It has multiple empid, 3124. &lt;/P&gt;&lt;P&gt;If you want delta to be the master table flip them around:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data updata;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;update delta transaction;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;by empid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 19:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155874#M30486</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-30T19:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155875#M30487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most difficult part of this is understanding the problem.&amp;nbsp; More specifically, answers to these questions would make the programming straightforward.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. In your original file before any updates are applied, do you have just one observation per ID? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If not, would you like all of the observations changed for that ID or only the most recent one? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Is there a variable on your original data that determines which observation is the most recent for a given ID?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. If the delta data set contains multiple observations for the same ID, how does that affect the desired result?&amp;nbsp; (Should all the changes be applied to the most recent observation only for that ID?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is conceivable that ballardw's original solution is all that you need ... as long as the answer to question 1 is "Yes".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 19:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155875#M30487</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-06-30T19:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Delta File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155876#M30488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the "delta" records replacements for the original data?&amp;nbsp; Or actual transactions (as the term is used within SAS by the UPDATE statement)?&amp;nbsp; There is a major difference with respect to missing values.&amp;nbsp; &lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001329173.htm" title="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001329173.htm"&gt;Step-by-Step Programming with Base SAS(R) Software&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have insertions in your "delta" files? That is can the delta add a brand new ID to the master file?&lt;/P&gt;&lt;P&gt;Do you have deletions in your "delta" files?&amp;nbsp; That is can the delta specify that a particular ID be removed from the mast file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 21:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delta-File/m-p/155876#M30488</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-06-30T21:10:41Z</dc:date>
    </item>
  </channel>
</rss>

