<?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: help with a natural join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469118#M119940</link>
    <description>&lt;P&gt;To be honest, I don't think I have ever used "natural" in any join ever.&amp;nbsp; Consult:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Visual_SQL_JOINS_orig.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21144i0EE531DD71AF040C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Visual_SQL_JOINS_orig.jpg" alt="Visual_SQL_JOINS_orig.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to get your data as you want using one of those.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 07:40:27 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-06-11T07:40:27Z</dc:date>
    <item>
      <title>help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469104#M119933</link>
      <description>&lt;P&gt;I'm trying to do a natural join but it seems that the tables aren't joining as I want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select
(case 
WHEN t1.condition = 'YES', THEN input(t2.number, 8.2)
else 0 end ) as column1
FROM
t1
NATURAL LEFT OUTER JOIN t2 t2;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;both my t1 and t2 tables have a 'condition' column with the same data type, so I expected them to pair together.&amp;nbsp; however, when I run both tables side by side, t2.column is all empty as if it is not joining.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 06:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469104#M119933</guid>
      <dc:creator>mrdlau</dc:creator>
      <dc:date>2018-06-11T06:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469105#M119934</link>
      <description>Start with select * from both tables and then perhaps you can find a pattern.</description>
      <pubDate>Mon, 11 Jun 2018 06:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469105#M119934</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-06-11T06:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469118#M119940</link>
      <description>&lt;P&gt;To be honest, I don't think I have ever used "natural" in any join ever.&amp;nbsp; Consult:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Visual_SQL_JOINS_orig.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21144i0EE531DD71AF040C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Visual_SQL_JOINS_orig.jpg" alt="Visual_SQL_JOINS_orig.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to get your data as you want using one of those.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 07:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469118#M119940</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-11T07:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469120#M119941</link>
      <description>&lt;P&gt;Please post the log from your code, that comma after 'YES' does not seem right at all.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 07:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469120#M119941</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-11T07:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469439#M120087</link>
      <description>&lt;P&gt;Considering the intent of Natural to "guess" what should match I find the use of Natural Left outer join to be "unnatural" if allowed a pun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean you are getting records that don't match at all don't be surprised. I tested your code with two data sets that had one variable name in common and no values for that variable in common:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table work.junk as
   select a.*, b.*
   from sashelp.class as a
   natural left outer join
   sashelp.baseball as b 
   ;
quit; &lt;/PRE&gt;
&lt;P&gt;The result is all of the data from the A set and missing values for all of the variables from the B set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest either specifying your variables you explicitly expect to have some match&amp;nbsp;with "left join on t1.var = t2.var" or similar or just use Natural.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Apr 2021 20:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/469439#M120087</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-25T20:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/736729#M229569</link>
      <description>&lt;P&gt;thanks a ton&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 09:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/736729#M229569</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2021-04-24T09:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: help with a natural join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/736730#M229570</link>
      <description>&lt;P&gt;thanks a ton&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 09:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-with-a-natural-join/m-p/736730#M229570</guid>
      <dc:creator>aanan1417</dc:creator>
      <dc:date>2021-04-24T09:16:01Z</dc:date>
    </item>
  </channel>
</rss>

