<?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: Left Join Problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714717#M220686</link>
    <description>What makes you think you have an error? If you're getting an error in the log, please post it. If it's because you're expecting 800 records, that's not quite right.&lt;BR /&gt;The WHERE clause is filtering out data so you're losing those records. Note that character comparisons are case sensitive so if you have Je it will not be included in your output. &lt;BR /&gt;&lt;BR /&gt;To determine how your records are being filtered you can play around with the WHERE clause to see which one is limiting the records.</description>
    <pubDate>Wed, 27 Jan 2021 18:30:10 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-01-27T18:30:10Z</dc:date>
    <item>
      <title>Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714694#M220675</link>
      <description>&lt;P&gt;Hello - I have 800 rows in my left table (no duplicates). When I Left join using code below it only extracts 250 rows and those are the ones that matched to left table. Can I please pick your brains to find error in my code? Thanks a lot!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;Create table WORK.ABC AS &lt;BR /&gt;Select Distinct a.*,&amp;nbsp;b.Name, b.Trans_date,&amp;nbsp;b.Client_Add Date,&amp;nbsp;b.Client_Type&lt;BR /&gt;&lt;BR /&gt;From WORK.CUSTOMERS a&lt;BR /&gt;LEFT JOIN SERVRE.TRANSACTIONS b ON ((a.ACCT_NO = b.ACCT_NO)&amp;nbsp;and (a.ID_NO = b.ID_NO))&lt;BR /&gt;WHERE (b.Name LIKE 'JE%') &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AND ((DATEPART(b.Trans_Date) &amp;gt;= '13JUL2020'D)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AND (DATEPART(b.Trans_Date) &amp;lt;= '18JAN2021'D))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AND (b.Client_Type = 'Continuously')&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;order by a.ACCT_NO,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a.ID_NO;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714694#M220675</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-01-27T18:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714697#M220676</link>
      <description>&lt;P&gt;Loose the distinct keyword.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714697#M220676</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-27T18:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714698#M220677</link>
      <description>&lt;P&gt;WHERE is applied the results of the LEFT JOIN.&lt;/P&gt;
&lt;P&gt;Try moving those extra restrictions into the ON condition instead.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714698#M220677</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-27T18:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714700#M220678</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/311117"&gt;@sasuser_sk&lt;/a&gt;&amp;nbsp; Can you try replacing WHERE with AND&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LEFT JOIN SERVRE.TRANSACTIONS b ON ((a.ACCT_NO = b.ACCT_NO) and (a.ID_NO = b.ID_NO))
AND (b.Name LIKE 'JE%') 
          AND ((DATEPART(b.Trans_Date) &amp;gt;= '13JUL2020'D)
         AND (DATEPART(b.Trans_Date) &amp;lt;= '18JAN2021'D))

        AND (b.Client_Type = 'Continuously')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:19:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714700#M220678</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-27T18:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714707#M220681</link>
      <description>&lt;P&gt;It didn't help rather created the duplicate rows.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714707#M220681</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-01-27T18:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714709#M220683</link>
      <description>&lt;P&gt;BINGOOOOOOO!!!!! Awesome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714709#M220683</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-01-27T18:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714711#M220685</link>
      <description>&lt;P&gt;Thanks for your response Tom.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 18:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714711#M220685</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-01-27T18:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714717#M220686</link>
      <description>What makes you think you have an error? If you're getting an error in the log, please post it. If it's because you're expecting 800 records, that's not quite right.&lt;BR /&gt;The WHERE clause is filtering out data so you're losing those records. Note that character comparisons are case sensitive so if you have Je it will not be included in your output. &lt;BR /&gt;&lt;BR /&gt;To determine how your records are being filtered you can play around with the WHERE clause to see which one is limiting the records.</description>
      <pubDate>Wed, 27 Jan 2021 18:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714717#M220686</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-27T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Left Join Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714744#M220697</link>
      <description>&lt;P&gt;Playing around with WHERE worked fine and I got all the records from left table back along with the data that matched with them.&amp;nbsp; Thx!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 19:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Left-Join-Problem/m-p/714744#M220697</guid>
      <dc:creator>sasuser_sk</dc:creator>
      <dc:date>2021-01-27T19:11:36Z</dc:date>
    </item>
  </channel>
</rss>

