<?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 ORDER BY following a LEFT JOIN Ambiguous reference error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557952#M155623</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273681"&gt;@RL997&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I also had a "where" statement in my code that I didn't think was relevant to my question.&amp;nbsp; That turned out to be the source of the ambiguous reference error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for looking at the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is why you will repeated requests to paste the code and any errors from the LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not uncommon to "simplify code" and remove the problem part because of an assumption of where a problem occurs. Often the part that SAS complains about is related to something occurring before the detection because of things like mismatched quotes, brackets or missing semicolons.&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2019 20:15:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-05-10T20:15:14Z</dc:date>
    <item>
      <title>PROC SQL ORDER BY following a LEFT JOIN Ambiguous reference error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557878#M155593</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to join tables in SQL and then order by an id common to the new and joined tables.&amp;nbsp; How do I get rid of the ambiguous reference error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;CREATE TABLE new AS&lt;BR /&gt;&amp;nbsp;SELECT A.*, B.*&lt;BR /&gt;&amp;nbsp;FROM table1 as A LEFT JOIN table2 as B&lt;BR /&gt;&amp;nbsp;ON A.id = B.id&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;ORDER BY A.id, A.xx;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: Ambiguous reference, column id is in more than one table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 16:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557878#M155593</guid>
      <dc:creator>RL997</dc:creator>
      <dc:date>2019-05-10T16:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL ORDER BY following a LEFT JOIN Ambiguous reference error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557925#M155609</link>
      <description>&lt;P&gt;I cannot reproduce this error. There is no name ambiguity in a.id. Your code should generate a warning instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;17   data t1;
18   set sashelp.class;
19   keep name height;
20   run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.T1 has 19 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


21
22   data t2;
23   set sashelp.class;
24   keep name weight;
25   run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.T2 has 19 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


26
27   proc sql;
28   create table new as
29   select a.*, b.*
30   from t1 as a left join t2 as b on a.name=b.name
31   order by a.name, a.height;
WARNING: Variable Name already exists on file WORK.NEW.
NOTE: Table WORK.NEW created, with 19 rows and 3 columns.

32   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.12 seconds
      cpu time            0.06 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 19:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557925#M155609</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-10T19:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL ORDER BY following a LEFT JOIN Ambiguous reference error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557949#M155621</link>
      <description>&lt;P&gt;I also had a "where" statement in my code that I didn't think was relevant to my question.&amp;nbsp; That turned out to be the source of the ambiguous reference error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for looking at the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 20:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557949#M155621</guid>
      <dc:creator>RL997</dc:creator>
      <dc:date>2019-05-10T20:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL ORDER BY following a LEFT JOIN Ambiguous reference error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557952#M155623</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273681"&gt;@RL997&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I also had a "where" statement in my code that I didn't think was relevant to my question.&amp;nbsp; That turned out to be the source of the ambiguous reference error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for looking at the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is why you will repeated requests to paste the code and any errors from the LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not uncommon to "simplify code" and remove the problem part because of an assumption of where a problem occurs. Often the part that SAS complains about is related to something occurring before the detection because of things like mismatched quotes, brackets or missing semicolons.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 20:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/557952#M155623</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-10T20:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL ORDER BY following a LEFT JOIN Ambiguous reference error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/558027#M155668</link>
      <description>&lt;P&gt;Rename one of ids.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;CREATE TABLE new AS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;SELECT A.*, B.*&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;FROM table1 as A LEFT JOIN table2 as B(rename=(id=_id))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;ON A.id = B._id&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 12:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/558027#M155668</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-05-11T12:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL ORDER BY following a LEFT JOIN Ambiguous reference error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/558065#M155695</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273681"&gt;@RL997&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I also had a "where" statement in my code that I didn't think was relevant to my question.&amp;nbsp; That turned out to be the source of the ambiguous reference error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for looking at the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please mark the question as solved then. Mark your previous answer with the explanation of why it was resolved.&lt;/P&gt;</description>
      <pubDate>Sat, 11 May 2019 18:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-ORDER-BY-following-a-LEFT-JOIN-Ambiguous-reference/m-p/558065#M155695</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-11T18:35:21Z</dc:date>
    </item>
  </channel>
</rss>

