<?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: How would I code a merge that will write the matches of both to one data set, the non-matches fr in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524314#M142576</link>
    <description>&lt;P&gt;The devil is in the details of what you 1) mean by matched 2) what the output should look like and 3) which method you are "matching".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A skeleton of a data step merge that does this:&lt;/P&gt;
&lt;PRE&gt;data matched notmatched;
   merge a (in=ina)
         b (in=inb)
   ;
   by byvariables;
   if ina and inb then output matched;
   else output notmatched;
run;&lt;/PRE&gt;
&lt;P&gt;The in variables are temporary variables not written to output and indicate which data sets are contributing to the current observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However without details of actual data output needs given some input sets a merge may not be appropriate, or what to do with like named variables other than those used on the BY statement are important to know.&lt;/P&gt;
&lt;P&gt;The matching is done on the values of variables on the BY statement and the data sets would need to all be sorted by the by variables prior to the merge.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jan 2019 16:36:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-01-03T16:36:25Z</dc:date>
    <item>
      <title>How would I code a merge that will write the matches of both to one data set, the non-matches from</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524243#M142538</link>
      <description>&lt;P&gt;&lt;STRONG&gt;How would I code a merge that will write the matches of both to one data set, the non-matches from the left-most data.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 11:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524243#M142538</guid>
      <dc:creator>rinugour</dc:creator>
      <dc:date>2019-01-03T11:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: How would I code a merge that will write the matches of both to one data set, the non-matches fr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524246#M142540</link>
      <description>&lt;P&gt;Left join in SQL, or a suitable data step merge. For a more detailed answer, please provide example data in usable form (data steps with datelines, see my footnotes).&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 12:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524246#M142540</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-03T12:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: How would I code a merge that will write the matches of both to one data set, the non-matches fr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524314#M142576</link>
      <description>&lt;P&gt;The devil is in the details of what you 1) mean by matched 2) what the output should look like and 3) which method you are "matching".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A skeleton of a data step merge that does this:&lt;/P&gt;
&lt;PRE&gt;data matched notmatched;
   merge a (in=ina)
         b (in=inb)
   ;
   by byvariables;
   if ina and inb then output matched;
   else output notmatched;
run;&lt;/PRE&gt;
&lt;P&gt;The in variables are temporary variables not written to output and indicate which data sets are contributing to the current observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However without details of actual data output needs given some input sets a merge may not be appropriate, or what to do with like named variables other than those used on the BY statement are important to know.&lt;/P&gt;
&lt;P&gt;The matching is done on the values of variables on the BY statement and the data sets would need to all be sorted by the by variables prior to the merge.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 16:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524314#M142576</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-03T16:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: How would I code a merge that will write the matches of both to one data set, the non-matches fr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524478#M142636</link>
      <description>&lt;OL&gt;&lt;LI&gt;&lt;SPAN class=""&gt;Data one two three;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;&lt;A title="Merge Data Set" href="https://data-flair.training/blogs/sas-merge-datasets/" target="_blank"&gt;Merge&lt;/A&gt; &lt;/SPAN&gt;&lt;SPAN class="kw1"&gt;DSN1&lt;/SPAN&gt; &lt;SPAN class="br0"&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;in=A&lt;/SPAN&gt;&lt;SPAN class="br0"&gt;)&lt;/SPAN&gt; &lt;SPAN class="kw1"&gt;DSN2&lt;/SPAN&gt; &lt;SPAN class="br0"&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;in=B&lt;/SPAN&gt;&lt;SPAN class="br0"&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;By ID;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;If A and B then output one;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;If A and not B then output two;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;If not A and B then output three;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;Run;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 04 Jan 2019 12:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-I-code-a-merge-that-will-write-the-matches-of-both-to/m-p/524478#M142636</guid>
      <dc:creator>anjita</dc:creator>
      <dc:date>2019-01-04T12:19:18Z</dc:date>
    </item>
  </channel>
</rss>

