<?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: Very Strange join issue for PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359237#M84480</link>
    <description>&lt;P&gt;change 'where' &amp;nbsp;condition to &amp;nbsp;'and' your results will change. &amp;nbsp;i had this issues before. &amp;nbsp;where condition &amp;nbsp;and 'and' work exactly same in inner join. it has tremendous impact on outer joins. Where condition &amp;nbsp;is applied first and returning rows are used for your outer jois. Still your results should be similar to inner join. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;suggests please post some more info.&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2017 00:44:30 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2017-05-17T00:44:30Z</dc:date>
    <item>
      <title>Very Strange join issue for PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359231#M84478</link>
      <description>&lt;P&gt;I am completely baffled by this one which is being run in a code window inside Enterprise Guide. There is a great deal of data in work.test3 - I want all customers in this table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I run 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 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; work.test7 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;distinct&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cs.cusprofile_An, t1.customerid, &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"VR"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; || substr(cats (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"0000000"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, put(CUSProfile_AN,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)),length (strip (cats (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"0000000"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, put(CUSProfile_AN,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;))))-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;) &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; VRID&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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; rimsrpt.rptcasesummary cs&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;inner join&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;work.test3 t1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cs.customerid = t1.customerid&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cs.extractdate = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;'30Apr2017'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;order&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; t1.customerid;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&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;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;and I get all but one person in wor.test3 which is what I would expect. But I run the following (which only creates a right join) and I get nothing. I can not figure out how that is possible. There should be more records with the outer join.&lt;/FONT&gt;&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 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; work.test7b &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;distinct&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cs.cusprofile_An, t1.customerid, &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"VR"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; || substr(cats (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"0000000"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, put(CUSProfile_AN,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;)),length (strip (cats (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"0000000"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, put(CUSProfile_AN,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;))))-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;) &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; VRID&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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; rimsrpt.rptcasesummary cs&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;right&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;join&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;work.test3 t1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cs.customerid = t1.customerid&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cs.extractdate = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;'30Apr2017'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;order&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; t1.customerid;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 23:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359231#M84478</guid>
      <dc:creator>noetsi</dc:creator>
      <dc:date>2017-05-16T23:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Very Strange join issue for PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359233#M84479</link>
      <description>&lt;P&gt;Post the full logs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 23:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359233#M84479</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-16T23:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Very Strange join issue for PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359237#M84480</link>
      <description>&lt;P&gt;change 'where' &amp;nbsp;condition to &amp;nbsp;'and' your results will change. &amp;nbsp;i had this issues before. &amp;nbsp;where condition &amp;nbsp;and 'and' work exactly same in inner join. it has tremendous impact on outer joins. Where condition &amp;nbsp;is applied first and returning rows are used for your outer jois. Still your results should be similar to inner join. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;suggests please post some more info.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 00:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359237#M84480</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-05-17T00:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Very Strange join issue for PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359238#M84481</link>
      <description>&lt;P&gt;You changed type of JOIN from INNER to RIGHT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the date in test3 is not the required one, you'll get no obs.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 00:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Very-Strange-join-issue-for-PROC-SQL/m-p/359238#M84481</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-05-17T00:46:57Z</dc:date>
    </item>
  </channel>
</rss>

