<?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 Full Join (SQL) ---- Merge (SAS)??? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Full-Join-SQL-Merge-SAS/m-p/11225#M1255</link>
    <description>Here we have an SQL full join code in SAS :&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test as select * from prod1 full join prod2 on (prod1.fund = prod2.fund);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
how can i write the same code by using Merge Statement in SAS Data Step Programming?&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
merge prod1 (in = a)&lt;BR /&gt;
          prod1 (in = b);&lt;BR /&gt;
by fund;&lt;BR /&gt;
??????????&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance.&lt;BR /&gt;
- Alankar</description>
    <pubDate>Wed, 28 Apr 2010 03:06:17 GMT</pubDate>
    <dc:creator>Alankar</dc:creator>
    <dc:date>2010-04-28T03:06:17Z</dc:date>
    <item>
      <title>Full Join (SQL) ---- Merge (SAS)???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Full-Join-SQL-Merge-SAS/m-p/11225#M1255</link>
      <description>Here we have an SQL full join code in SAS :&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table test as select * from prod1 full join prod2 on (prod1.fund = prod2.fund);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
how can i write the same code by using Merge Statement in SAS Data Step Programming?&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
merge prod1 (in = a)&lt;BR /&gt;
          prod1 (in = b);&lt;BR /&gt;
by fund;&lt;BR /&gt;
??????????&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks in Advance.&lt;BR /&gt;
- Alankar</description>
      <pubDate>Wed, 28 Apr 2010 03:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Full-Join-SQL-Merge-SAS/m-p/11225#M1255</guid>
      <dc:creator>Alankar</dc:creator>
      <dc:date>2010-04-28T03:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Full Join (SQL) ---- Merge (SAS)???</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Full-Join-SQL-Merge-SAS/m-p/11226#M1256</link>
      <description>You don't need any additional statements, &lt;B&gt;merge by&lt;/B&gt; does a full join by default.&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;merge by&lt;/B&gt; does however  require that tables/views you merge be sorted or indexed by the merge keys before-hand, whereas sql can sort (or do other things) on the fly if needed. &lt;BR /&gt;
&lt;BR /&gt;
One case where the results will be different between &lt;B&gt;merge by&lt;/B&gt; and sql are if you have non-unique keys in both tables as &lt;B&gt;merge by&lt;/B&gt; does not do cartesian products.&lt;BR /&gt;
&lt;BR /&gt;
Another case is if you have identically named variables, as sql will keep the values from the first table, whereas &lt;B&gt;merge by&lt;/B&gt; will overwrite them with the second table's values.</description>
      <pubDate>Wed, 28 Apr 2010 03:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Full-Join-SQL-Merge-SAS/m-p/11226#M1256</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2010-04-28T03:35:41Z</dc:date>
    </item>
  </channel>
</rss>

