<?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 OUTER JOIN why it is restricted to max 2 tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715949#M221189</link>
    <description>&lt;P&gt;%put Hi _ALL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I was wondering about OUTER JOINS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;It is written in some books for eg.: like&amp;nbsp;&lt;SPAN&gt;Kirk Paul Lafler's book 'PROC SQL: Beyound the basics...'&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;that&amp;nbsp; OUTER JOINS can be used with... and it is a quote:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P class="ABody"&gt;Outer Joins&lt;/P&gt;&lt;P class="ABody0"&gt;A maximum of two tables are referenced in a FROM and ON clause of a SELECT statement.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P class="ABody0"&gt;I was wondering why and when it could occur becouse we can easily use multiple left join or right join or full join in a query;&lt;/P&gt;&lt;P class="ABody0"&gt;Could You tell, show me an example and info from the sas log with such a 'wrong' example.&lt;/P&gt;&lt;P class="ABody0"&gt;I would be thankfull;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Feb 2021 04:27:44 GMT</pubDate>
    <dc:creator>ToTylkoGra</dc:creator>
    <dc:date>2021-02-02T04:27:44Z</dc:date>
    <item>
      <title>OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715949#M221189</link>
      <description>&lt;P&gt;%put Hi _ALL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I was wondering about OUTER JOINS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;It is written in some books for eg.: like&amp;nbsp;&lt;SPAN&gt;Kirk Paul Lafler's book 'PROC SQL: Beyound the basics...'&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;that&amp;nbsp; OUTER JOINS can be used with... and it is a quote:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P class="ABody"&gt;Outer Joins&lt;/P&gt;&lt;P class="ABody0"&gt;A maximum of two tables are referenced in a FROM and ON clause of a SELECT statement.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P class="ABody0"&gt;I was wondering why and when it could occur becouse we can easily use multiple left join or right join or full join in a query;&lt;/P&gt;&lt;P class="ABody0"&gt;Could You tell, show me an example and info from the sas log with such a 'wrong' example.&lt;/P&gt;&lt;P class="ABody0"&gt;I would be thankfull;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 04:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715949#M221189</guid>
      <dc:creator>ToTylkoGra</dc:creator>
      <dc:date>2021-02-02T04:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715974#M221201</link>
      <description>&lt;P&gt;Perhaps you are overthinking this statement.&lt;/P&gt;
&lt;P&gt;It's just about syntax. And like you say, you can have multiple outer joins in the same query (but not in the same ON clause).&lt;/P&gt;
&lt;P&gt;So not sure what else need to be said.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 08:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715974#M221201</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2021-02-02T08:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715980#M221205</link>
      <description>&lt;P&gt;The correct word for SAS SQL syntax is FULL JOIN.&lt;/P&gt;
&lt;P&gt;Maxim 4: Try It.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input id $;
datalines;
A
B
C
;

data b;
input id $;
datalines;
D
E
F
;

data c;
input id $;
datalines;
G
H
I
;

proc sql;
create table want as
  select coalesce(a.id,b.id,c.id) as id
  from a
  full join b
  on a.id = b.id
  full join c
  on a.id = c.id
  order by calculated id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can always have multiple joins in a single query, but only two tables in a single join.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 09:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/715980#M221205</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-02T09:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/716210#M221303</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Perhaps you are overthinking this statement.&lt;/P&gt;&lt;P&gt;It's just about syntax. And like you say, you can have multiple outer joins in the same query (but not in the same ON clause).&lt;/P&gt;&lt;P&gt;So not sure what else need to be said.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank You for quick response.&lt;/P&gt;&lt;P&gt;Maybe You are right but then is no difference between INNER JOIN and OUTER JOIN syntax and it is also written (in the same book) that:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;INNER JOINS:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;A join that only retrieves rows with matching values from two or more tables (&lt;STRONG&gt;maximum of 256 tables&lt;/STRONG&gt;). This type of join is referred to as a conventional type of join.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;OUTER JOINS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ajoin that retrieves rows with matching values while preserving some or all of the unmatched rows from one or both tables (&lt;STRONG&gt;maximum of 2 tables&lt;/STRONG&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;If You can show me an example of using an "ON" clause with two or more tables.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So why Maxiumum of 2 tables? It is same syntax like inner join.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 20:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/716210#M221303</guid>
      <dc:creator>ToTylkoGra</dc:creator>
      <dc:date>2021-02-02T20:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/716211#M221304</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;The correct word for SAS SQL syntax is FULL JOIN.&lt;/P&gt;&lt;P&gt;Maxim 4: Try It.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input id $;
datalines;
A
B
C
;

data b;
input id $;
datalines;
D
E
F
;

data c;
input id $;
datalines;
G
H
I
;

proc sql;
create table want as
  select coalesce(a.id,b.id,c.id) as id
  from a
  full join b
  on a.id = b.id
  full join c
  on a.id = c.id
  order by calculated id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can always have multiple joins in a single query, but only two tables in a single join.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Tnak You for quick response !&lt;/P&gt;&lt;P&gt;I see that it is a good example of correct syntax.&lt;/P&gt;&lt;P&gt;But I want a wrong syntax to prove that OUTER JOIN is restricted to max two tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SQL a statement is&amp;nbsp; from a "select"(becouse select is a statement) to&amp;nbsp; "quit" is a example of query (and it contains clauses like "ON" "WHERE" "FROM" ETC)&amp;nbsp; and we know&amp;nbsp; that we can nest queries with other queries. "ON" is a clause and it is a part of a OUTER JOIN and also of an INNER JOIN so why it is written that max 2 tables is resticted when INNER JOIN and OUTER JOIN is the same syntax.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can You show me a example of a WRONG example that uses more then two tables in OUTER QUERY to show how I can make the sytax wrong with the single join.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its like.&lt;/P&gt;&lt;P&gt;SELECT *&amp;nbsp;&lt;/P&gt;&lt;P&gt;FROM a FULL JOIN b&amp;nbsp;&lt;/P&gt;&lt;P&gt;on a.id=b.id and C.id=a.id;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;the error is I put C table in On clause and I didnt JOIN it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is no difference with INNER JOIN and I still dont understand why INNER JOIN is for 256 tables and OUTER JOIN is for max 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 20:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/716211#M221304</guid>
      <dc:creator>ToTylkoGra</dc:creator>
      <dc:date>2021-02-02T20:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/716261#M221327</link>
      <description>&lt;P&gt;Looks to me like bad wording in the documentation.&lt;/P&gt;
&lt;P&gt;Report to Tech support so they can request that it is fixed (you might have to insist a bit and defend your point to get it accepted).&lt;/P&gt;
&lt;P&gt;[Edit: One of the book is not an official SAS book, but it is edited by SAS Publications, so I reckon they should stand by both books you mention in your recent reply.]&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 05:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/716261#M221327</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-10T05:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717558#M221925</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/58588"&gt;@ToTylkoGra&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To review,&amp;nbsp;&lt;STRONG&gt;INNER&lt;/STRONG&gt; joins produce a result that includes all matching records from multiple tables based on one or more conditions.&amp;nbsp; That's why it makes sense that we could pull these from as many tables as we want, as we'll get values only from the records that match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;OUTER&amp;nbsp;&lt;/STRONG&gt;joins produce a result that pulls ALL records from one or two tables, matching records when possible and adding null values when there isn't a match.&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;FULL&lt;/STRONG&gt; outer join pulls all records from two tables,&amp;nbsp;&lt;STRONG&gt;LEFT&lt;/STRONG&gt; outer join pulls all records from the first table in the&amp;nbsp;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;and matching records from the second table, where&amp;nbsp;&lt;STRONG&gt;RIGHT&lt;/STRONG&gt; outer join pulls matching records from the first table and all records from the second.&amp;nbsp; This is usually represented by a Venn diagram to show the result, always with just two circles (one for each table).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=sqlproc&amp;amp;docsetTarget=p0o4a5ac71mcchn1kc1zhxdnm139.htm&amp;amp;locale=en" target="_self"&gt;Selecting Data from More Than One Table By Using Joins&lt;/A&gt;&amp;nbsp;in the SAS documentation for a better, more complete explanation of what is possible. Ultimately you can join records from as many tables as you want, but when combining OUTER join types it's best to think in terms of result sets, where the results from one join are then joined with another table or result set (so, usually joining these in pairs).&amp;nbsp; Ordering your joins and specifying the correct join conditions can be somewhat of an artform, especially when you are trying to optimize for the best performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case you're wondering, this is one of the big differences between DATA step and PROC SQL.&amp;nbsp; In DATA step you tell SAS exactly &lt;STRONG&gt;how&lt;/STRONG&gt; to combine tables to get what you want. In SQL you tell SAS &lt;STRONG&gt;what&lt;/STRONG&gt; you want, and SAS will optimize the SQL to make it happen.&amp;nbsp; See this &lt;A href="https://youtu.be/ksZH_LoXnKk" target="_self"&gt;video tutorial for more information on SQL vs DATA step&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 12:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717558#M221925</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-02-08T12:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717769#M222021</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;I don't understand how you are pitting INNER against OUTER joins in terms of table or data handling.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;INNER joins are also represented on a 2-circle Venn diagram, only merge 2 tables per join, and otherwise behave identically in terms of data-matching to OUTER joins.&lt;/P&gt;
&lt;P&gt;There is no difference in my eyes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case you are thinking about the SQL syntax that uses a comma-separated list of table names followed by a WHERE clause -instead of using the word JOIN and a ON clause- is not specific to INNER joins and is used to create all types of joins. So I am confused by your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In all cases, the logic is: join two tables by matching the rows according to the keys and by dropping the rows as requested, and optionally match more tables following a similar logic.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 01:07:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717769#M222021</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-09T01:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717877#M222073</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;Maybe I'm trying to simplify too much for the sake of the OP here, and yes, I was thinking of the comma syntax in PROC SQL that -- in my experience -- is usually used for the intent of INNER join (focusing only on what's common among all named tables).&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 12:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717877#M222073</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-02-09T12:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717880#M222076</link>
      <description>&lt;P&gt;Thank You guys for responses.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;our Community Manager.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;It is good to hear/see that pandemic did not kill everyone.&lt;/P&gt;&lt;P&gt;Thank You &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt; for the link to SAS Documentation. It is always the best foundation.&lt;/P&gt;&lt;P&gt;I have not found &amp;nbsp;there anything sugesting that outer joins are restricted to max two tables.&lt;/P&gt;&lt;P&gt;Venn diagram is a vizualization of kind of joins as You mantioned in your post.&lt;/P&gt;&lt;P&gt;And also thanks for the wideo about merge vs sql join is great review and I recommend it to everyone. (I could hardly focus on the content but finnaly I made it )&lt;/P&gt;&lt;P&gt;I think @DominiqueWeatherspoon should mention about that SQL JOINS also have a ‘control processing’ with some proc sql options like &amp;nbsp;magic=101, magic=102 magic=103.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets get back to the main topic. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I will start from the beggining. If someone is not familiar what is going on please read all of the earlier information posted. &amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is based on few excerpts from two books published by SAS. The first book is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC SQL, 3rd Edition&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;by Kirk Paul Lafler&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Published by SAS Institute, 2019&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;And the second book is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SAS® Certification Prep Guide&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Advanced Programming for SAS®9 Fourth Edition&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this topic we will try only talk about HORIZONTAL JOINS. OUTER JOIN(left, right, full) is a part of the horizontal join and INNER JOIN is also a horizontal join.&lt;/P&gt;&lt;P&gt;In the first book author mentioned two times about OUTER JOINS like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="KirkPaullafler_screeen1.jpg" style="width: 568px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54500i3CC08575ACBDAF21/image-size/large?v=v2&amp;amp;px=999" role="button" title="KirkPaullafler_screeen1.jpg" alt="KirkPaullafler_screeen1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="kirp_paul2.jpg" style="width: 888px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54501iB864DE9DA9652BBD/image-size/large?v=v2&amp;amp;px=999" role="button" title="kirp_paul2.jpg" alt="kirp_paul2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the Certification Book:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="sas_cert_book_1.jpg" style="width: 920px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54502i9564F6950C8737CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas_cert_book_1.jpg" alt="sas_cert_book_1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Creating an Inner Join with Outer Join-Style Syntax.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="sas_cert_book2.jpg" style="width: 592px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54503i9589809A387CFF92/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas_cert_book2.jpg" alt="sas_cert_book2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;„OUTER JOIN why it is restricted to max 2 tables” is the main question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The question says that OUTER JOINS are restricet to 2 tables but realy are they ?&lt;/P&gt;&lt;P&gt;Why it is written in thouse sources that there is a restriction?&lt;/P&gt;&lt;P&gt;Basing on the information as I mentioned earlier from the two books we can make two questions/hypothesis. &amp;nbsp;&lt;/P&gt;&lt;P&gt;H0 - &lt;STRONG&gt;OUTER JOINS are restricted to two tables&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;H1 - &lt;STRONG&gt;OUTER JOINS are not restricted two tables&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Lets consider folowing example:&lt;/P&gt;&lt;P&gt;The macro is as simple as it can be. It is creating a join &amp;nbsp;with a type of your choice and the number of tables. If someone do not understand the macro I will try to explain it in priv msg if someone wants or here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint mcompilenote=all;

%macro innerouter(join=inner, numberoftables=255);
proc sql;
select a.z1
from a
%do i=1 %to &amp;amp;numberoftables;
&amp;amp;join join a
as a&amp;amp;i
on a.z1=a&amp;amp;i..z1
%end;
;
quit;
%mend;



Invocation of the macro and not producting error in the log:&lt;BR /&gt;
%innerouter(join=left, numberoftables=255)
%innerouter(join=right, numberoftables=255)
%innerouter(join=full, numberoftables=255)
%innerouter(join=inner, numberoftables=255)

Invocation of the macro and producing error in the log:&lt;BR /&gt;
%innerouter(join=left, numberoftables=256)
%innerouter(join=right, numberoftables=256)
%innerouter(join=full, numberoftables=256)
%innerouter(join=inner, numberoftables=256)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: A maximum of 256 tables can be processed in a single PROC SQL statement.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Column z1 could not be found in the table/view identified with the correlation name A256.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Column z1 could not be found in the table/view identified with the correlation name A256.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;And the Note form the CERT BOOK ALSO:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="aboutInnerjoins_capabilities.jpg" style="width: 588px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54504iD88D7E5AC2270D6D/image-size/large?v=v2&amp;amp;px=999" role="button" title="aboutInnerjoins_capabilities.jpg" alt="aboutInnerjoins_capabilities.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following this logic it proves that every kind of horizontal join is processed in a single join and it is capable to proces a maxiumum of 256 table at a time. To be completly accurate to the information from the macro - numberoftables=255 is 255 tables + first table = 256 (the rest tables are self joined iterations).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to understand those informations from those books related to this point of view ?&lt;/P&gt;&lt;P&gt;What author was thinking mentioning about maxiumum of two tables &amp;nbsp;at a time?&lt;/P&gt;&lt;P&gt;Is it a posible misleading text in those books?&lt;/P&gt;&lt;P&gt;If I wrote something that is a crack in my logic or something that is not true just feel free and write want is wrong and what You think.&lt;/P&gt;&lt;P&gt;%put Greetings _ALL_;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 06:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717880#M222076</guid>
      <dc:creator>ToTylkoGra</dc:creator>
      <dc:date>2021-02-11T06:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717882#M222077</link>
      <description>&lt;P&gt;Thank You&amp;nbsp;@&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961" target="_blank" rel="noopener"&gt;ChrisNZ&lt;/A&gt;&amp;nbsp;for this point of view.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote more information about the problem under the&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4" target="_blank" rel="noopener"&gt;@ChrisHemedinger&lt;/A&gt;&amp;nbsp;post.&lt;/P&gt;&lt;DIV class="sas-author-rank"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Feb 2021 12:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717882#M222077</guid>
      <dc:creator>ToTylkoGra</dc:creator>
      <dc:date>2021-02-09T12:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717884#M222078</link>
      <description>&lt;P&gt;Any time you use the JOIN keyword, you can only combine two tables with it; further tables need additional JOINs.&lt;/P&gt;
&lt;P&gt;The (usually inner) join method that works with a comma-separated list of tables in the FROM clause and a WHERE condition accepts any arbitrary number of tables.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 12:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/717884#M222078</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-09T12:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718054#M222141</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;&amp;nbsp;comma-separated list of tables in the FROM clause and a WHERE condition accepts any arbitrary number of tables.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;That is not my experience. 256 tables is the maximum regardless of the syntax used.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 22:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718054#M222141</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-09T22:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718055#M222142</link>
      <description>&lt;P&gt;I cannot make sense of the wording used.&lt;/P&gt;
&lt;P&gt;One join of any type is always between 2 tables.&lt;/P&gt;
&lt;P&gt;The maximum number of tables joined in a query is always 256 tables.&lt;/P&gt;
&lt;P&gt;I am unsure what the author wanted to communicate here.&lt;/P&gt;
&lt;P&gt;It's best to ask him I reckon.&lt;/P&gt;
&lt;P&gt;Let us know if you find out.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 22:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718055#M222142</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-09T22:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718060#M222144</link>
      <description>&lt;P&gt;The comma separated list of tables are more like full joins. Or as the log notes call it "Cartesian product joins".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can filter the results with a WHERE clause to make the results look like an inner join.&lt;/P&gt;
&lt;PRE&gt;385   data age(keep=age) sex(keep=sex);
386     do age=1 to 10 ; output age; end;
387     do sex='M','F'; output sex; end;
388   run;

NOTE: The data set WORK.AGE has 10 observations and 1 variables.
NOTE: The data set WORK.SEX has 2 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.03 seconds


389
390   proc sql;
391   create table test as
392   select *
393   from age,sex
394   ;
NOTE: The execution of this query involves performing one or more Cartesian product joins that can not be
      optimized.
NOTE: Table WORK.TEST created, with 20 rows and 2 columns.

395   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.12 seconds
      cpu time            0.03 seconds

&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Feb 2021 22:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718060#M222144</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-09T22:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718068#M222148</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;&amp;nbsp;comma-separated list of tables in the FROM clause and a WHERE condition accepts any arbitrary number of tables.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;That is not my experience. 256 tables is the maximum regardless of the syntax used.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then let's say "arbitrary within the overall limits of the SQL procedure".&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 23:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718068#M222148</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-09T23:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: OUTER JOIN why it is restricted to max 2 tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718072#M222149</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;The where clause determines the type of join.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;The point is there is no difference between comma-delimited table list queries and queries that use the JOIN keyword in terms of max number of tables.&lt;/P&gt;
&lt;P&gt;So to go back to the original question, there intent of the author when writing the text mentioned is unclear.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 23:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/OUTER-JOIN-why-it-is-restricted-to-max-2-tables/m-p/718072#M222149</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-09T23:59:43Z</dc:date>
    </item>
  </channel>
</rss>

