<?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: Updating a master data set from an update data set. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31971#M6144</link>
    <description>Before I put my question on this forum I have been searching on the Internet, but haven't found any solution.&lt;BR /&gt;
&lt;BR /&gt;
I state that UPDATE doesn't work. I have tried with MERGE and MODIFY in different ways, but the only  X values that are changed are the ones for each ID:s first record.&lt;BR /&gt;
&lt;BR /&gt;
I hope someone can help me. Many people must have had to do the same kind of operation.</description>
    <pubDate>Fri, 15 May 2009 08:38:22 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-05-15T08:38:22Z</dc:date>
    <item>
      <title>Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31969#M6142</link>
      <description>The master data set MDS have variables ID, X and several others. The update data set UDS have variables ID and X.&lt;BR /&gt;
&lt;BR /&gt;
New values for X is given in UDS.&lt;BR /&gt;
&lt;BR /&gt;
If there were only one observation for each ID, I could use the code:&lt;BR /&gt;
&lt;BR /&gt;
UPDATE MDS UDS;&lt;BR /&gt;
BY ID;&lt;BR /&gt;
&lt;BR /&gt;
But how do I code if there are multiple observations for each ID in the master data set, and I want all observations for an ID(identity) updated according to the update data set?

Message was edited by: ErnestoC</description>
      <pubDate>Thu, 14 May 2009 09:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31969#M6142</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-14T09:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31970#M6143</link>
      <description>Performed a search of the SAS support websitte  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  with the two SAS-hosted documentation references for your consideration.  The site has a wealth of supplemental technical reference documents as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Updating SAS Data Sets&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304308.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304308.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Modifying SAS Data Sets&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001331353.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001331353.htm&lt;/A&gt;</description>
      <pubDate>Thu, 14 May 2009 12:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31970#M6143</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-14T12:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31971#M6144</link>
      <description>Before I put my question on this forum I have been searching on the Internet, but haven't found any solution.&lt;BR /&gt;
&lt;BR /&gt;
I state that UPDATE doesn't work. I have tried with MERGE and MODIFY in different ways, but the only  X values that are changed are the ones for each ID:s first record.&lt;BR /&gt;
&lt;BR /&gt;
I hope someone can help me. Many people must have had to do the same kind of operation.</description>
      <pubDate>Fri, 15 May 2009 08:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31971#M6144</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-15T08:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31972#M6145</link>
      <description>Share your SAS code with the SAS log - post a reply pasting the information.  Also, you will want to include PUTLOG _ALL_;  messages (dump all variables to SAS log).  Of course this information may help with your own problem debugging before sending to the forum.  SAS version (and service pack), operating platform are also useful.  Of course, after exhausting all available debugging options, you may want to contact SAS support with your particulars, opening a SAS track on the website.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 15 May 2009 10:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31972#M6145</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-15T10:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31973#M6146</link>
      <description>Scott Barry, are you God?</description>
      <pubDate>Fri, 15 May 2009 10:40:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31973#M6146</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-15T10:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31974#M6147</link>
      <description>Oh &lt;B&gt;God&lt;/B&gt;, I did it just by myself.&lt;BR /&gt;
&lt;BR /&gt;
DATA UDS(RENAME=(X=Y));&lt;BR /&gt;
SET UDS;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
DATA MDS;&lt;BR /&gt;
MERGE MDS UDS;&lt;BR /&gt;
BY ID;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
DATA MDS(DROP=Y);&lt;BR /&gt;
SET MDS;&lt;BR /&gt;
IF X~=Y AND Y~=. THEN X=Y;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
Good heavens!</description>
      <pubDate>Fri, 15 May 2009 11:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31974#M6147</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-15T11:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31975#M6148</link>
      <description>Glad to see you were successful - for optimization, you may be able to reduce your code to a single DATA step, doing the RENAME= and DROP= on the SET statement (data set options in parentheses), and along with using the IN= on the SET for each contributing SAS file with your MERGE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 15 May 2009 12:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31975#M6148</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-15T12:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a master data set from an update data set.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31976#M6149</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I think that the following solution should also meet your expectations.&lt;BR /&gt;
The advantage is that your datasets do not need to be sorted in the same order and/or BY-variables.&lt;BR /&gt;
&lt;BR /&gt;
Please let me know &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Florent&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
          update MDS a&lt;BR /&gt;
          set X = (select coalesce(b.X, a.X)&lt;BR /&gt;
                      from UDS b&lt;BR /&gt;
                      where a.ID = b.ID);&lt;BR /&gt;
QUIT;</description>
      <pubDate>Wed, 20 May 2009 16:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-a-master-data-set-from-an-update-data-set/m-p/31976#M6149</guid>
      <dc:creator>Florent</dc:creator>
      <dc:date>2009-05-20T16:54:36Z</dc:date>
    </item>
  </channel>
</rss>

