<?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: Merging data sets and keeping one set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104401#M21806</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was the second option, thanks. I am sorting both data sets prior to merging. Both sorts are by docket_id. Can I add a second sort by a date column (edate) and then just keep the first instance of edate (where it is lowest)? In the below code, do you know how would I only keep the first (lowest) value of edate?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=work.issuejoinedevents;&lt;/P&gt;&lt;P&gt;by docket_id edate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Oct 2012 21:51:03 GMT</pubDate>
    <dc:creator>Paul_NYS</dc:creator>
    <dc:date>2012-10-23T21:51:03Z</dc:date>
    <item>
      <title>Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104397#M21802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to merge two SAS datasets with the below data step. However, I would like to keep all the records of the issueJoined data set and not just only those that have a matching record in the issuejoinedevents data set. Is this possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right, I am not getting any records in the resulting data set. However, when I run a proc SQL server and join the same two data sets through the same column, docket_id, I am getting records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data s10;&lt;/P&gt;&lt;P&gt;merge work.issueJoined work.issuejoinedevents (keep=edate rename=(edate=issueJoinDate));&lt;/P&gt;&lt;P&gt;by docket_id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 19:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104397#M21802</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-23T19:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104398#M21803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;Hi,&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;I added the &lt;SPAN style="color: #ff0000;"&gt;RED&lt;/SPAN&gt; parts. Also both datasets have to be sorted by docket_id.&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;data s10;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;merge work.issueJoined&lt;SPAN style="color: #ff0000;"&gt;(in=a)&lt;/SPAN&gt;&amp;nbsp; work.issuejoinedevents (keep=&lt;SPAN style="color: #ff0000;"&gt;docked_id&lt;/SPAN&gt; edate rename=(edate=issueJoinDate));&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;by docket_id;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="color: #ff0000;"&gt;if a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 20:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104398#M21803</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-10-23T20:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104399#M21804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;H Linlin&lt;/P&gt;&lt;P&gt;I did as you indicated above and revised the code to reflect the below. It seemed to generally work, however, in the original issueJoined, there are 114,744 records and in the resulting s10 data set, there are 115,608 records. I have not completely looked yet, but I am assuming some records from the issuejoinedevents data set were included that do not have a matching record in the issueJoined data set. Is this possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data s10;&lt;/P&gt;&lt;P&gt;merge work.issueJoined(in=a) work.issuejoinedevents (keep=docket_id edate rename=(edate=issueJoinDate));&lt;/P&gt;&lt;P&gt;by docket_id;&lt;/P&gt;&lt;P&gt;if a;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 21:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104399#M21804</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-23T21:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104400#M21805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, that's not possible using this code.&amp;nbsp; What is happening is that some of the docket_id values in IssueJoinedEvents appear multiple times within that data set.&amp;nbsp; As a result, they appear multiple times in the merged data set as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 21:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104400#M21805</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-10-23T21:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104401#M21806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was the second option, thanks. I am sorting both data sets prior to merging. Both sorts are by docket_id. Can I add a second sort by a date column (edate) and then just keep the first instance of edate (where it is lowest)? In the below code, do you know how would I only keep the first (lowest) value of edate?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=work.issuejoinedevents;&lt;/P&gt;&lt;P&gt;by docket_id edate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 21:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104401#M21806</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-23T21:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104402#M21807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way using proc sort would be to use two sorts.&amp;nbsp; i.e.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;proc sort data=work.issuejoinedevents;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp; by docket_id edate;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;run;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;which would order the file by edates within docket_id, following which you could keep only the earliest date with another sort:&lt;/P&gt;&lt;P style="font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-family: inherit; font-style: inherit;"&gt;proc sort data=work.issuejoinedevents nodupkey;&lt;/P&gt;&lt;P style="font-family: inherit; font-style: inherit;"&gt;&amp;nbsp; by docket_id;&lt;/P&gt;&lt;P style="font-family: inherit; font-style: inherit;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 21:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104402#M21807</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-10-23T21:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Merging data sets and keeping one set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104403#M21808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That seemed to have worked. I found the nodupkey, but adding the second sort just using the docket_id made it work completely. Thanks to everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 22:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-data-sets-and-keeping-one-set/m-p/104403#M21808</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2012-10-23T22:36:34Z</dc:date>
    </item>
  </channel>
</rss>

