<?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: proc sql left join vs proc sql inner join in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267728#M58056</link>
    <description>&lt;P&gt;Use the one that makes logical sense. In this case you have a 1 to 1 match. If you always expect this use an inner match, if you can't trust this rule&amp;nbsp;and always want the information from a specific table use the right/left join instead.&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2016 21:13:21 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-05-02T21:13:21Z</dc:date>
    <item>
      <title>proc sql left join vs proc sql inner join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267726#M58055</link>
      <description>&lt;P&gt;If a LEFT JOIN and an INNER JOIN return the exact same rows, which is more efficient to use?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
	mrn='1111';cpt='aaa';output;
	mrn='2222';cpt='bbb';output;
	mrn='3333';cpt='ccc';output;
	mrn='4444';cpt='ddd';output;
run;

data two;
	mrn='1111';age=22;output;
	mrn='2222';age=44;output;
	mrn='3333';age=66;output;
	mrn='4444';age=11;output;
run;

proc sql noprint;
	create table blah1 as
		select
			a.mrn,
			a.cpt,
			b.age
		from
			one a
			inner join two b
				on a.mrn=b.mrn;

	create table blah2 as
		select
			a.mrn,
			a.cpt,
			b.age
		from
			one a
			left join two b
				on a.mrn=b.mrn;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 21:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267726#M58055</guid>
      <dc:creator>dataMart87</dc:creator>
      <dc:date>2016-05-02T21:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join vs proc sql inner join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267728#M58056</link>
      <description>&lt;P&gt;Use the one that makes logical sense. In this case you have a 1 to 1 match. If you always expect this use an inner match, if you can't trust this rule&amp;nbsp;and always want the information from a specific table use the right/left join instead.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 21:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267728#M58056</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-02T21:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join vs proc sql inner join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267806#M58062</link>
      <description>To extend &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; answer - if your logic holds for inner joins - those are better performing than outer joins generally speaking.</description>
      <pubDate>Tue, 03 May 2016 04:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/267806#M58062</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-03T04:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join vs proc sql inner join</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/268950#M58122</link>
      <description>&lt;P&gt;Thanks. &amp;nbsp;I always thought INNER JOINS were not as efficient as a LEFT JOIN or a RIGHT JOIN because INNER JOINS check rows common to both tables, whereas LEFT JOINS or RIGHT JOINS just check for rows on either the left-hand or right-hand table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm curious what the exceptions are to this rule, if any?&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 23:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-left-join-vs-proc-sql-inner-join/m-p/268950#M58122</guid>
      <dc:creator>dataMart87</dc:creator>
      <dc:date>2016-05-06T23:31:35Z</dc:date>
    </item>
  </channel>
</rss>

