<?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 multiple left joins in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/multiple-left-joins/m-p/374010#M89499</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this program, &amp;nbsp;the final table is not getting any records from table z &amp;nbsp;as there is matching column in table y and z (id2)? &amp;nbsp;I know intermediate table from first left join is not picking id2 = 12 record. &amp;nbsp;How do include second record from table y so it can be joined with table z?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data x;
	input id1 var1 $;
	cards;
1  a
2  b
;
run;

data y;
	input id1 id2 var2 $;
	cards;
1 11 c
3 12 d
;
run;

data z;
	input id2 var3 $;
	cards;
12 e
;
run;

proc sql noprint;
	create table want as
		select	a.var1,
			b.var2,
			c.var3
		from x as a
			left join y as b 
				on a.id1 = b.id1  
			left join z as c 
				on b.id2 = c.id2;
quit;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2017 16:27:57 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2017-07-07T16:27:57Z</dc:date>
    <item>
      <title>multiple left joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-left-joins/m-p/374010#M89499</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this program, &amp;nbsp;the final table is not getting any records from table z &amp;nbsp;as there is matching column in table y and z (id2)? &amp;nbsp;I know intermediate table from first left join is not picking id2 = 12 record. &amp;nbsp;How do include second record from table y so it can be joined with table z?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data x;
	input id1 var1 $;
	cards;
1  a
2  b
;
run;

data y;
	input id1 id2 var2 $;
	cards;
1 11 c
3 12 d
;
run;

data z;
	input id2 var3 $;
	cards;
12 e
;
run;

proc sql noprint;
	create table want as
		select	a.var1,
			b.var2,
			c.var3
		from x as a
			left join y as b 
				on a.id1 = b.id1  
			left join z as c 
				on b.id2 = c.id2;
quit;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 16:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-left-joins/m-p/374010#M89499</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-07-07T16:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: multiple left joins</title>
      <link>https://communities.sas.com/t5/SAS-Programming/multiple-left-joins/m-p/374019#M89500</link>
      <description>&lt;P&gt;you need to do a full join in the begining , something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;noprint&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a.var1,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;b.var2,&lt;/P&gt;
&lt;P&gt;c.var3&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; x &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;full&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; y &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; a.id1 = b.id1 &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;inner&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; z &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; c &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b.id2 = c.id2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 16:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/multiple-left-joins/m-p/374019#M89500</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-07-07T16:41:37Z</dc:date>
    </item>
  </channel>
</rss>

