<?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: Proc SQL- Joining 5 tables in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399574#M12130</link>
    <description>&lt;P&gt;Yes, this was the problem, I guess I was sleeping at the end.&amp;nbsp; I fixed that and it works, thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2017 18:10:13 GMT</pubDate>
    <dc:creator>Oalmend</dc:creator>
    <dc:date>2017-09-28T18:10:13Z</dc:date>
    <item>
      <title>Proc SQL- Joining 5 tables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399548#M12126</link>
      <description>&lt;P&gt;I need to join variables from 5 tables, they all have Key ID in common (STATEID).&amp;nbsp; The code below is not working.&amp;nbsp; See sas log also.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE PROBLEMSPN AS
SELECT C.*,
W.ST,
R.REASONTEXT,
R.SPECIES,
S.DATE_TO_CDC,
S.SPECIES,
SR.DATERCVD
FROM cms_st2 C,
SPN.SPNWGS W,
SPN.REASONS R,
SPN.SHIPMENTS S,
STAR.STARLIMS SR
WHERE C.STATEID = W.STATEID AND
C.STATEID = R.REASONTEXT AND 
C.STATEID = S.SHIPMENTS AND 
C.STATEID = SR.STARLIMS;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;188 PROC SQL;&lt;/P&gt;&lt;P&gt;189 CREATE TABLE PROBLEMSPN AS&lt;/P&gt;&lt;P&gt;190 SELECT C.*,&lt;/P&gt;&lt;P&gt;191 W.ST,&lt;/P&gt;&lt;P&gt;192 R.REASONTEXT,&lt;/P&gt;&lt;P&gt;193 R.SPECIES,&lt;/P&gt;&lt;P&gt;194 S.DATE_TO_CDC,&lt;/P&gt;&lt;P&gt;195 S.SPECIES,&lt;/P&gt;&lt;P&gt;196 SR.DATERCVD&lt;/P&gt;&lt;P&gt;197 FROM cms_st2 C,&lt;/P&gt;&lt;P&gt;198 SPN.SPNWGS W,&lt;/P&gt;&lt;P&gt;199 SPN.REASONS R,&lt;/P&gt;&lt;P&gt;200 SPN.SHIPMENTS S,&lt;/P&gt;&lt;P&gt;201 STAR.STARLIMS SR&lt;/P&gt;&lt;P&gt;202 WHERE C.STATEID = W.STATEID AND&lt;/P&gt;&lt;P&gt;203 C.STATEID = R.REASONTEXT AND&lt;/P&gt;&lt;P&gt;204 C.STATEID = S.SHIPMENTS AND&lt;/P&gt;&lt;P&gt;205 C.STATEID = SR.STARLIMS;&lt;/P&gt;&lt;P&gt;ERROR: Column SHIPMENTS could not be found in the table/view identified with the correlation&lt;/P&gt;&lt;P&gt;name S.&lt;/P&gt;&lt;P&gt;ERROR: Column STARLIMS could not be found in the table/view identified with the correlation&lt;/P&gt;&lt;P&gt;name SR.&lt;/P&gt;&lt;P&gt;206 QUIT;&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/P&gt;&lt;P&gt;real time 0.20 seconds&lt;/P&gt;&lt;P&gt;cpu time 0.04 seconds&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 16:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399548#M12126</guid>
      <dc:creator>Oalmend</dc:creator>
      <dc:date>2017-09-28T16:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Joining 5 tables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399558#M12127</link>
      <description>&lt;P&gt;It looks like someone went home for the day and never really finished editing the program.&amp;nbsp; Look at all the conditions in the WHERE clause.&amp;nbsp; Do you really expect STATEID from one data set will be equal to REASONTEXT from another data set?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 17:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399558#M12127</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-28T17:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Joining 5 tables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399559#M12128</link>
      <description>&lt;P&gt;You are asking for variables that don't exist from your referenced data sets. You need to double check the names of the variables in SPN&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;SHIPMENTS&amp;nbsp; and STAR&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;STARLIMS&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A guess is that the variable names don't end in S, Shipment and StarLim instead of Shipments and Starlims.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 17:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399559#M12128</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-28T17:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Joining 5 tables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399574#M12130</link>
      <description>&lt;P&gt;Yes, this was the problem, I guess I was sleeping at the end.&amp;nbsp; I fixed that and it works, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 18:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Proc-SQL-Joining-5-tables/m-p/399574#M12130</guid>
      <dc:creator>Oalmend</dc:creator>
      <dc:date>2017-09-28T18:10:13Z</dc:date>
    </item>
  </channel>
</rss>

