<?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: Keeping track of data that didn't make it when merging two datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351571#M273744</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Application;
input ID $ Name $;
datalines;
1    Bob
2    Bill
3    Judy
4    John
;

data Registration;
input ID $ Name $;
datalines;
1    Bob
2    Bill
3    Judy
4    John
5    Jake
6    Jack
;

data matches nonmatches;
merge application (in=a) registration (in = b);
by ID;
if a and b then output matches;
else output nonmatches;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Apr 2017 08:06:36 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-04-20T08:06:36Z</dc:date>
    <item>
      <title>Keeping track of data that didn't make it when merging two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351570#M273743</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two data sets I want to merge. One is application&amp;nbsp;information, the second is registrations. There are some who registered but did not fill out an application.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose we have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Application:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp;Name &amp;nbsp;... (other variables)&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp;Bob&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;Bill&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp;Judy&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp; &amp;nbsp;John&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Registration:&lt;BR /&gt;&lt;BR /&gt;ID &amp;nbsp;Name ... (other variables)&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp;Bob&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;Bill&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp;Judy&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp; &amp;nbsp;John&lt;/P&gt;
&lt;P&gt;5 &amp;nbsp; &amp;nbsp;Jake&lt;/P&gt;
&lt;P&gt;6 &amp;nbsp; &amp;nbsp;Jack&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know how&amp;nbsp;to merge them as such:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data merge;&lt;/P&gt;
&lt;P&gt;merge application (in=a) registration (in = b);&lt;/P&gt;
&lt;P&gt;by ID;&lt;/P&gt;
&lt;P&gt;if a and b;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However. I would like SAS to also give me an output dataset of those who were not in both application and registration (i.e., ID's # 5 and 6 - Jake and Jack).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I'd like code to give me two datasets:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Merge:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ID &amp;nbsp;Name... (other variables from both datasets)&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp;Bob&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;Bill&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp;Judy&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp; &amp;nbsp;John&lt;/P&gt;
&lt;P&gt;5 &amp;nbsp; &amp;nbsp;Jake&lt;/P&gt;
&lt;P&gt;6 &amp;nbsp; &amp;nbsp;Jack&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and remainder:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ID &amp;nbsp;Name ...(other variables)&lt;/P&gt;
&lt;P&gt;5 &amp;nbsp; &amp;nbsp;Jake&lt;/P&gt;
&lt;P&gt;6 &amp;nbsp; &amp;nbsp;Jack&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So it gives me the names of just those two where not in the&amp;nbsp;application dataset as well&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do this? I've seen it before, but can't remember how to search it unfortunately.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Gina&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 08:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351570#M273743</guid>
      <dc:creator>ginak</dc:creator>
      <dc:date>2017-04-20T08:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping track of data that didn't make it when merging two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351571#M273744</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Application;
input ID $ Name $;
datalines;
1    Bob
2    Bill
3    Judy
4    John
;

data Registration;
input ID $ Name $;
datalines;
1    Bob
2    Bill
3    Judy
4    John
5    Jake
6    Jack
;

data matches nonmatches;
merge application (in=a) registration (in = b);
by ID;
if a and b then output matches;
else output nonmatches;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2017 08:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351571#M273744</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-04-20T08:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping track of data that didn't make it when merging two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351572#M273745</link>
      <description>&lt;P&gt;Please also use the search bar, and look at the previous posts. &amp;nbsp;This merging question was asked at least 3 or 4 time yesterday and the day before, and the day before that. &amp;nbsp;Also, post test data &lt;STRONG&gt;in the form of a datastep! &amp;nbsp;&lt;/STRONG&gt;You can use the alias to output whre you want e.g.: (and I have not test data to check this on):&lt;/P&gt;
&lt;PRE&gt;data inboth other;
  merge first (in=a) second (in=b);
  by keyvariable;
  if a and b then output inboth;
  else output other;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 08:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351572#M273745</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-20T08:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping track of data that didn't make it when merging two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351884#M273746</link>
      <description>&lt;P&gt;Thank you!! Yes, it was late at night and I tried but wasn't sure what keywords exactly to use &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Good advice re formatting w/ a data step. Will note.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 19:46:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351884#M273746</guid>
      <dc:creator>ginak</dc:creator>
      <dc:date>2017-04-20T19:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping track of data that didn't make it when merging two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351885#M273747</link>
      <description>&lt;P&gt;Yes, thank you!!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 19:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-track-of-data-that-didn-t-make-it-when-merging-two/m-p/351885#M273747</guid>
      <dc:creator>ginak</dc:creator>
      <dc:date>2017-04-20T19:46:20Z</dc:date>
    </item>
  </channel>
</rss>

