<?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 Left join not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351788#M81916</link>
    <description>I have a left join that is working like a normal join&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table have as&lt;BR /&gt;(Select&lt;BR /&gt;A.dny,&lt;BR /&gt;A.type,&lt;BR /&gt;A.orderdste,&lt;BR /&gt;B.type,&lt;BR /&gt;B.delivery,&lt;BR /&gt;B.dny&lt;BR /&gt;From table a left join table b on a.dny=b.dny&lt;BR /&gt;Where a.orderdste =b.delivery&lt;BR /&gt;);&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;The output it should bring everything from table a I'm looking for all the dny in table a that are not in table b ...</description>
    <pubDate>Thu, 20 Apr 2017 16:38:12 GMT</pubDate>
    <dc:creator>Gil_</dc:creator>
    <dc:date>2017-04-20T16:38:12Z</dc:date>
    <item>
      <title>Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351788#M81916</link>
      <description>I have a left join that is working like a normal join&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table have as&lt;BR /&gt;(Select&lt;BR /&gt;A.dny,&lt;BR /&gt;A.type,&lt;BR /&gt;A.orderdste,&lt;BR /&gt;B.type,&lt;BR /&gt;B.delivery,&lt;BR /&gt;B.dny&lt;BR /&gt;From table a left join table b on a.dny=b.dny&lt;BR /&gt;Where a.orderdste =b.delivery&lt;BR /&gt;);&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;The output it should bring everything from table a I'm looking for all the dny in table a that are not in table b ...</description>
      <pubDate>Thu, 20 Apr 2017 16:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351788#M81916</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T16:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351789#M81917</link>
      <description />
      <pubDate>Thu, 20 Apr 2017 16:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351789#M81917</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T16:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351800#M81925</link>
      <description>&lt;P&gt;You don't need to state your request as a subquerry AND, more importantly, your code will produce the wrong results&amp;nbsp;the way you have your input tables defined in your from statement. You are defining a file called table, referring to it as A, and left joining it with itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you don't need the warning you'll get for selecting the columns (with the same names) from the two files. No need to select them from the second file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are your two input datasets called? TableA and TableB, or A and B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&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;</description>
      <pubDate>Thu, 20 Apr 2017 17:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351800#M81925</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-20T17:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351804#M81926</link>
      <description>Hi Art I'm using generic name for tables&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table have as&lt;BR /&gt;(Select&lt;BR /&gt;A.dny,&lt;BR /&gt;A.type,&lt;BR /&gt;A.orderdste,&lt;BR /&gt;B.type,&lt;BR /&gt;B.delivery,&lt;BR /&gt;B.dny&lt;BR /&gt;From test A left join test1 b on a.dny=b.dny&lt;BR /&gt;Where a.orderdste =b.delivery&lt;BR /&gt;);&lt;BR /&gt;Run;</description>
      <pubDate>Thu, 20 Apr 2017 17:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351804#M81926</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T17:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351808#M81927</link>
      <description>&lt;P&gt;Not sure what you mean by "generic table names", but your where statement seems to contradict what you said you wanted. Does the following do what you expect?:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
  informat orderdste date9.;
  input dny type orderdste;
  cards;
1 1 20jan2017
2 3 26jan2017
3 2 2feb2017
4 4 3mar2017
;

data test1;
  informat delivery date9.;
  input dny type delivery;
  cards;
1 1 20jan2017
4 4 3mar2017
;

proc sql;
  create table have as
    Select
      A.dny,
      A.type,
      A.orderdste
        From test a left join test1 b
          on a.dny=b.dny
            where b.delivery is null
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 17:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351808#M81927</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-20T17:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351825#M81932</link>
      <description>I change the name of tables to not be confusing. Thanks art</description>
      <pubDate>Thu, 20 Apr 2017 17:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351825#M81932</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T17:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351836#M81933</link>
      <description>Art,&lt;BR /&gt;The Dny. Is What I'm looking fro m test and where I match from test1 both table will always have date but in some cases Dny won't be in test1 but will be in test....reason for left join ...hope that helps explain what I need</description>
      <pubDate>Thu, 20 Apr 2017 18:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351836#M81933</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T18:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351839#M81935</link>
      <description>&lt;P&gt;You are not getting all records from table a because the where condition&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;a.orderdste = b.delivery&lt;/EM&gt; is false when there is no matching record in table b.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Use&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;From table a left join table b on a.dny=b.dny and&amp;nbsp;a.orderdste=b.delivery&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;intead.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 18:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351839#M81935</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-20T18:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351842#M81937</link>
      <description>Pgstats sorry not sure what I'm doing wrong I should get 3 but only get 2. Results ... the date will always be there... the dny won't be on both tabled it will be in test could be because of the dny=dny where it has to equal to Dny?</description>
      <pubDate>Thu, 20 Apr 2017 18:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351842#M81937</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T18:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351858#M81945</link>
      <description>&lt;P&gt;Given the two test files I posted earlier, show us which records you expect to get and why.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 19:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351858#M81945</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-20T19:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351863#M81950</link>
      <description>&lt;P&gt;Your query should read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
Create table want as
Select
	A.dny,
	A.type,
	A.orderdste,
	B.type
From 
	test as A left join 
	test1 as B on A.dny=B.dny and A.orderdste=B.delivery;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2017 19:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351863#M81950</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-20T19:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351870#M81955</link>
      <description>Here is the data in the tables&lt;BR /&gt;Test&lt;BR /&gt;Dny. type. ordered&lt;BR /&gt;123 I. 04/18/17&lt;BR /&gt;134. I. 04/18/17&lt;BR /&gt;145. I. . 04/18/17&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Test1&lt;BR /&gt;Dny. Type. Delivery&lt;BR /&gt;123. I. 04/18/17&lt;BR /&gt;134. I. 04/18/17&lt;BR /&gt;456. I. 04/18/17&lt;BR /&gt;567. I. 04/18/17&lt;BR /&gt;I want output to bring everything where we match test and test1</description>
      <pubDate>Thu, 20 Apr 2017 19:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351870#M81955</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T19:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Left join not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351882#M81963</link>
      <description>Thank you both for the assistance</description>
      <pubDate>Thu, 20 Apr 2017 19:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-join-not-working/m-p/351882#M81963</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-04-20T19:44:33Z</dc:date>
    </item>
  </channel>
</rss>

