<?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: JHelp:joining multiple Tables with SQL Languages in Advanced Programming</title>
    <link>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773106#M132</link>
    <description>Thanks, for these tips.&lt;BR /&gt;I found my mistake &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Fri, 08 Oct 2021 17:57:05 GMT</pubDate>
    <dc:creator>CorinneT</dc:creator>
    <dc:date>2021-10-08T17:57:05Z</dc:date>
    <item>
      <title>JHelp:joining multiple Tables with SQL Languages</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773042#M130</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, somebody could help me? I don't undersand the LOG. I have no result, because zero rows! Thanks in advance.&lt;/P&gt;&lt;P&gt;Corinne.&lt;/P&gt;&lt;P&gt;Subject: I would like to join 4 tables, see below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;sq.statepopulation&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sq.regioncode&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sq.divisioncode&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sq.statecode&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Region&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(the region code)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;RegionCode&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;STRONG&gt;DivisionCode&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;StateCode&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Division&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(the division code)&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;RegionName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;DivisionName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;StateName&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(the state code)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Births3&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(an indicator&lt;/P&gt;&lt;P&gt;of state-lvel,&lt;/P&gt;&lt;P&gt;three-year projected births)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql feedback;&lt;BR /&gt;/*create table toto as*/&lt;BR /&gt;select s.Births3 format=ddmmyy10.&lt;BR /&gt;,r.RegionName&lt;BR /&gt;,d.DivisionName&lt;BR /&gt;,t.StateCode&lt;BR /&gt;from sq.statepopulation as s inner join&lt;BR /&gt;sq.regioncode as r&lt;BR /&gt;on s.Region=r.RegionCode inner join&lt;BR /&gt;sq.divisioncode as d&lt;BR /&gt;on s.Division=d.DivisionCode inner join&lt;BR /&gt;sq.statecode as t /*** &amp;lt;--------ISSUE THERE!*/&lt;BR /&gt;on s.Name=t.StateName;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Log says:&lt;/P&gt;&lt;DIV class="sasSource"&gt;OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 proc sql feedback;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 /*create table toto as*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 select s.Births3 format=ddmmyy10.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 ,r.RegionName&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 ,d.DivisionName&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 ,t.StateCode&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 from sq.statepopulation as s inner join&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 sq.regioncode as r&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 on s.Region=r.RegionCode inner join&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 sq.divisioncode as d&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 on s.Division=d.DivisionCode inner join&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 sq.statecode as t&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 on s.Name=t.StateName;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Statement transforms to:&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;select S.Births3 format=DDMMYY10.0, R.RegionName, D.DivisionName, T.StateCode&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;from SQ.STATEPOPULATION S inner join SQ.REGIONCODE R on S.Region = R.RegionCode inner join SQ.DIVISIONCODE D on&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;S.Division = D.DivisionCode inner join SQ.STATECODE T on S.Name = T.StateName;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: No rows were selected.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 quit;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE SQL a utilisé (Durée totale du traitement) :&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;user cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;memory 6436.18k&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;OS Memory 31156.00k&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Timestamp 08/10/2021 01:48:53 PM&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Step Count 89 Switch Count 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Reclaims 342&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Voluntary Context Switches 18&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Block Output Operations 16&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Oct 2021 14:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773042#M130</guid>
      <dc:creator>CorinneT</dc:creator>
      <dc:date>2021-10-08T14:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: JHelp:joining multiple Tables with SQL Languages</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773048#M131</link>
      <description>&lt;P&gt;Try doing the joins one at a time and examining the results. That should tell you which particular join is causing problems. I suspect you might be assuming the issue is with your T table. You don't show any specific reason, such as VALUES of any variables that makes T the specific issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure that the Name and Statename have the same spellling and case. If one has "NEW YORK" and the other has "New York" then there is no match. Watch for things like leading spaces as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might consider left joins instead of inner. That way you can see if anything from the Statepopulation table has matches on any of the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 15:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773048#M131</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-08T15:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: JHelp:joining multiple Tables with SQL Languages</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773106#M132</link>
      <description>Thanks, for these tips.&lt;BR /&gt;I found my mistake &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 08 Oct 2021 17:57:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/JHelp-joining-multiple-Tables-with-SQL-Languages/m-p/773106#M132</guid>
      <dc:creator>CorinneT</dc:creator>
      <dc:date>2021-10-08T17:57:05Z</dc:date>
    </item>
  </channel>
</rss>

