<?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: Merge, not delete, duplicates. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141059#M37666</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it out! I had to trim some values in the one data set - here it was leaving extra spaces. I used TRIM and now when I merge, it merges great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2015 03:43:54 GMT</pubDate>
    <dc:creator>dereck255</dc:creator>
    <dc:date>2015-01-28T03:43:54Z</dc:date>
    <item>
      <title>Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141052#M37659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data set that has a large about of information between two systems. The observations in the data include a Name, an ID1, ID2, Cat1, Cat2, Cat3, Date in System1, Date in System2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect all entries to have dates in both systems. Right now, each "Name" is listed twice:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID2&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Cat1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center; background-color: #6690bc;"&gt;Cat2&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center; background-color: #6690bc;"&gt;Cat3&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;DateSys1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;DateSys2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Adam&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11Jan2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Adam&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12Jan2015&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to see is:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID2&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Cat1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center; background-color: #6690bc;"&gt;Cat2&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; font-size: 13.3333330154419px; text-align: center; background-color: #6690bc;"&gt;Cat3&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;DateSys1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;DateSys2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Adam&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1001&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2002&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11Jan2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;12Jan2015&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Where the duplicate entry is merged based on the observations being equal in &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Name, ID1, ID2, Cat1, Cat2, Cat3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help? Thank you! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 22:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141052#M37659</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-27T22:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141053#M37660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did you merge the data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 22:29:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141053#M37660</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-01-27T22:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141054#M37661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I merged the data sets by &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #f8f8f8;"&gt;Name, ID1, ID2, Cat1, Cat2, Cat3 but it didn't exactly work. So how can I do it after the datasets merged?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 23:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141054#M37661</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-27T23:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141055#M37662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code please. Merge using data step or proc sql? Are the combinations of your key variables repeated in either or both data sets?&lt;/P&gt;&lt;P&gt;Were there any warning messages?&lt;/P&gt;&lt;P&gt;And probably best to go back to the step that combined them then try to fix other stuff later.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 00:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141055#M37662</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-01-28T00:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141056#M37663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the update trick instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;update have(obs=0) have;&lt;/P&gt;&lt;P&gt;by name id1 id2 cat1 cat2 cat3;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may want to figure out why your merge didn't work though, because it is one way to do it. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 00:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141056#M37663</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T00:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141057#M37664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I merged by a data merge by statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll have to double check, but there were no errors. I confirmed that I sorted both data sets by the same variables that I merged them by. I think the issue lies around one of the cat variables - I had to remove a character string from one of the data sets so that the names matched across data sets. When I merged by that cat variable, I get the issue that I'm having now (see original post).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not familiar with update. What exactly does it do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 00:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141057#M37664</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-28T00:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141058#M37665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The 'trick' is having the same data set as the master and transaction dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the documentation:&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;In a DATA step, the UPDATE statement reads observations from the transaction data set and updates corresponding observations (observations with the same value of all BY variables) from the master data set. All nonmissing values for variables in the transaction data set replace the corresponding values that are read from the master data set. SAS writes the modified observations to the data set that you name in the DATA statement without modifying either the master or the transaction data set.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001329151.htm" title="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001329151.htm"&gt;Step-by-Step Programming with Base SAS(R) Software&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 01:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141058#M37665</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T01:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Merge, not delete, duplicates.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141059#M37666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it out! I had to trim some values in the one data set - here it was leaving extra spaces. I used TRIM and now when I merge, it merges great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 03:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merge-not-delete-duplicates/m-p/141059#M37666</guid>
      <dc:creator>dereck255</dc:creator>
      <dc:date>2015-01-28T03:43:54Z</dc:date>
    </item>
  </channel>
</rss>

