<?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 ERROR: unresolved reference to table/correlation name a in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865001#M341562</link>
    <description>&lt;PRE&gt;&lt;CODE class=""&gt;Hi.&lt;BR /&gt;I&amp;nbsp;have&amp;nbsp;tried&amp;nbsp;everything&amp;nbsp;I&amp;nbsp;could&amp;nbsp;think&amp;nbsp;of&amp;nbsp;to&amp;nbsp;resolve&amp;nbsp;this&amp;nbsp;error. Please&amp;nbsp;check&amp;nbsp;my&amp;nbsp;code&lt;BR /&gt;to&amp;nbsp;find&amp;nbsp;the&amp;nbsp;error&amp;nbsp;I&amp;nbsp;have&amp;nbsp;made. First time poster.&lt;BR /&gt;&lt;BR /&gt;Diane&lt;BR /&gt;&lt;BR /&gt;%let pyr=15; %let yr=16;
options obs=1000000;

proc sql;
CONNECT TO SQLSVR AS CDW(DATAsrc=xxxxxxxxxxxxxxxx
	&amp;amp;SQL_OPTIMAL.);

create table test as select 
labchemresultnumericvalue,
b.LabChemTestName,c.Topography from

 connection to cdw

(select labchemresultnumericvalue,
b.LabChemTestName,c.Topography from

&amp;lt;project name&amp;gt;.src.chem_labchem as a

	left join CDWWork.dim.labchemtest as  b on  
		a.LabChemTestSID=b.labchemtestsid

	left join CDWWork.dim.Topography as c  on 
		a.TopographySID=c.TopographySID;);

disconnect from cdw;

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="log.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81738i07BCEA381DE7E7C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="log.png" alt="log.png" /&gt;&lt;/span&gt;
c&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 17 Mar 2023 22:40:55 GMT</pubDate>
    <dc:creator>steffick</dc:creator>
    <dc:date>2023-03-17T22:40:55Z</dc:date>
    <item>
      <title>ERROR: unresolved reference to table/correlation name a</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865001#M341562</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;Hi.&lt;BR /&gt;I&amp;nbsp;have&amp;nbsp;tried&amp;nbsp;everything&amp;nbsp;I&amp;nbsp;could&amp;nbsp;think&amp;nbsp;of&amp;nbsp;to&amp;nbsp;resolve&amp;nbsp;this&amp;nbsp;error. Please&amp;nbsp;check&amp;nbsp;my&amp;nbsp;code&lt;BR /&gt;to&amp;nbsp;find&amp;nbsp;the&amp;nbsp;error&amp;nbsp;I&amp;nbsp;have&amp;nbsp;made. First time poster.&lt;BR /&gt;&lt;BR /&gt;Diane&lt;BR /&gt;&lt;BR /&gt;%let pyr=15; %let yr=16;
options obs=1000000;

proc sql;
CONNECT TO SQLSVR AS CDW(DATAsrc=xxxxxxxxxxxxxxxx
	&amp;amp;SQL_OPTIMAL.);

create table test as select 
labchemresultnumericvalue,
b.LabChemTestName,c.Topography from

 connection to cdw

(select labchemresultnumericvalue,
b.LabChemTestName,c.Topography from

&amp;lt;project name&amp;gt;.src.chem_labchem as a

	left join CDWWork.dim.labchemtest as  b on  
		a.LabChemTestSID=b.labchemtestsid

	left join CDWWork.dim.Topography as c  on 
		a.TopographySID=c.TopographySID;);

disconnect from cdw;

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="log.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81738i07BCEA381DE7E7C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="log.png" alt="log.png" /&gt;&lt;/span&gt;
c&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Mar 2023 22:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865001#M341562</guid>
      <dc:creator>steffick</dc:creator>
      <dc:date>2023-03-17T22:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: unresolved reference to table/correlation name a</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865004#M341565</link>
      <description>&lt;P&gt;Try changing your first statement to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table test as select 
labchemresultnumericvalue,
LabChemTestName,Topography from&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I removed the a. and b. table aliases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that when you run code with explicit pass-through like this (it's a great feature to use), the code in parentheses is executed by the remote database.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(select labchemresultnumericvalue,
b.LabChemTestName,c.Topography from

&amp;lt;project name&amp;gt;.src.chem_labchem as a

	left join CDWWork.dim.labchemtest as  b on  
		a.LabChemTestSID=b.labchemtestsid

	left join CDWWork.dim.Topography as c  on 
		a.TopographySID=c.TopographySID;)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;runs on SQL server.&amp;nbsp; SAS doesn't know about this code, and doesn't execute it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first part of your code which is not in the parentheses will be run by SAS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table test as select 
labchemresultnumericvalue,
b.LabChemTestName,c.Topography from&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But&amp;nbsp; since the SAS code doesn't define an alias named a or b, it throws an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 22:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865004#M341565</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-03-17T22:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: unresolved reference to table/correlation name a</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865540#M341825</link>
      <description>Thank you very much.&lt;BR /&gt;Diane</description>
      <pubDate>Tue, 21 Mar 2023 18:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-unresolved-reference-to-table-correlation-name-a/m-p/865540#M341825</guid>
      <dc:creator>steffick</dc:creator>
      <dc:date>2023-03-21T18:24:01Z</dc:date>
    </item>
  </channel>
</rss>

