<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41199#M8427</link>
    <description>Try this&lt;BR /&gt;
first sort the two data sets basis the matching variable then apply the code below;&lt;BR /&gt;
&lt;BR /&gt;
data target_dataset;&lt;BR /&gt;
   merge src_dataset1 (in = a) src_dataset2 (in = b);&lt;BR /&gt;
   by &lt;MATCHING variables=""&gt;;&lt;BR /&gt;
   if a &amp;amp; b then output;&lt;BR /&gt;
run;&lt;/MATCHING&gt;</description>
    <pubDate>Fri, 15 Jan 2010 07:50:51 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-01-15T07:50:51Z</dc:date>
    <item>
      <title>MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41198#M8426</link>
      <description>How would code a merge that  will keep only observations that have match both the set.</description>
      <pubDate>Fri, 15 Jan 2010 07:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41198#M8426</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-15T07:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41199#M8427</link>
      <description>Try this&lt;BR /&gt;
first sort the two data sets basis the matching variable then apply the code below;&lt;BR /&gt;
&lt;BR /&gt;
data target_dataset;&lt;BR /&gt;
   merge src_dataset1 (in = a) src_dataset2 (in = b);&lt;BR /&gt;
   by &lt;MATCHING variables=""&gt;;&lt;BR /&gt;
   if a &amp;amp; b then output;&lt;BR /&gt;
run;&lt;/MATCHING&gt;</description>
      <pubDate>Fri, 15 Jan 2010 07:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41199#M8427</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-15T07:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41200#M8428</link>
      <description>Leena,&lt;BR /&gt;
have you any rules for handling data which could match more than one row on either side?&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Sat, 16 Jan 2010 09:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41200#M8428</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-16T09:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41201#M8429</link>
      <description>For a 1-to-N match stick with the data/merge.&lt;BR /&gt;
&lt;BR /&gt;
For a N-to-N match, the easiest way would be coding it through SQL.&lt;BR /&gt;
&lt;BR /&gt;
To my knowledge, data/merge N-way match is actually possible, but it involves using an index and a requires one of the tables to be quite small, on top of that the implementation is quite obscure.&lt;BR /&gt;
&lt;BR /&gt;
If you are running 9.2 you could try the new features of the hash object, being one, the possibility to load into the hash object multiple obs with the same key.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Mon, 18 Jan 2010 08:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41201#M8429</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-18T08:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41202#M8430</link>
      <description>Daniel&lt;BR /&gt;
since the data-step merge is easier than SQL unless n-n join/merge is required, I had to ask my question&lt;BR /&gt;
 Regards&lt;BR /&gt;
PeterC</description>
      <pubDate>Mon, 18 Jan 2010 09:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41202#M8430</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-01-18T09:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: MERGE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41203#M8431</link>
      <description>Yes, Peter.&lt;BR /&gt;
&lt;BR /&gt;
I was just discussing my point of view of the 1-N/N-N scenarios.&lt;BR /&gt;
&lt;BR /&gt;
Your question makes perfect sense to me, I would go for the SQL only for a N-to-N match. I also found Merge easier than SQL, and a lot more "controlable".&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Mon, 18 Jan 2010 09:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MERGE/m-p/41203#M8431</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-18T09:55:47Z</dc:date>
    </item>
  </channel>
</rss>

