<?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 Insert Into syntax in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488343#M72020</link>
    <description>&lt;P&gt;For the love of... the column name had a typo in table B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes it's staring you in the face and you can't see it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Kurt!&lt;/P&gt;</description>
    <pubDate>Mon, 20 Aug 2018 20:14:39 GMT</pubDate>
    <dc:creator>ProcLunchbreak</dc:creator>
    <dc:date>2018-08-20T20:14:39Z</dc:date>
    <item>
      <title>Proc SQL Insert Into syntax</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488330#M72018</link>
      <description>&lt;P&gt;Hello! I have&amp;nbsp;datasets A and B in different formats with similar data that I'm trying to groom into a single dataset called COMBINED. All of the columns but one are working. In table A we have UserIDs with a string length of two, in table B the UserIDs have a string length of 5, but I would like to shorten it to the first two characters. My code at the moment looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE WORK.COMBINED AS SELECT
/*Other data grooming removed here for brevity*/&lt;BR /&gt;  A.Name as Name,&lt;BR /&gt;  A.UserID AS UserID
FROM WORK.TableA A ;

INSERT INTO WORK.COMBINED (
/*list of all fields here*/
)
SELECT
/*Other data grooming removed for brevity*/&lt;BR /&gt;  B.Name AS Name,&lt;BR /&gt;  SUBSTR(B.UserID,1,2) AS UserID
FROM WORK.TableB B ;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I receive the errors&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Column&amp;nbsp;UserID could not be found in the table/view identified with the correlation name B.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Unresolved reference to table/correlation name B.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Commenting out&amp;nbsp;this UserID variable, the files combine as expected. Is this not the correct way to reference table B within the substring function? Should I employ a different method in order to take the first two characters of table B's UserID string?&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Thanks in advance for any help you can provide.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 19:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488330#M72018</guid>
      <dc:creator>ProcLunchbreak</dc:creator>
      <dc:date>2018-08-20T19:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Insert Into syntax</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488338#M72019</link>
      <description>&lt;P&gt;Maxim 3: know your data.&lt;/P&gt;
&lt;P&gt;What the message says. There is no column userid in tableb.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 20:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488338#M72019</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-20T20:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Insert Into syntax</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488343#M72020</link>
      <description>&lt;P&gt;For the love of... the column name had a typo in table B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes it's staring you in the face and you can't see it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Kurt!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 20:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL-Insert-Into-syntax/m-p/488343#M72020</guid>
      <dc:creator>ProcLunchbreak</dc:creator>
      <dc:date>2018-08-20T20:14:39Z</dc:date>
    </item>
  </channel>
</rss>

