<?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: Help: ERROR: Duplicate column names have been detected in the above query which requested that C in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291906#M60502</link>
    <description>&lt;P&gt;Your problem will derive form the use of:&lt;/P&gt;
&lt;P&gt;select *&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What this means it that you take every variable from all incoming datasets. &amp;nbsp;Then you are selecting at least one variable a second time:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;imb_dlvry_zip_5&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the select * will pull in a.imb_dlvry_zip_5 and so will that line in your code, hence you end up with duplicate variables.&lt;/P&gt;
&lt;P&gt;Unless there is a specific reason to do so, I would not use select *, it is sloppy coding. &amp;nbsp;You, the owner of the data and the one who know what they want should specify each and every column you want to find in your output table. &amp;nbsp;Then, if things change with the table your code does not.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2016 14:00:01 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-08-16T14:00:01Z</dc:date>
    <item>
      <title>Help: ERROR: Duplicate column names have been detected in the above query which requested that CORRE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291895#M60500</link>
      <description>&lt;P&gt;I need some help troubleshooting this error. Am I doing something wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;4621      proc sql;
4622      create table QueryData&amp;amp;ZIP5 as
SYMBOLGEN:  Macro variable ZIP5 resolves to 00926
4623      select  *,
4624              "A" as source,
4625              "-" as RuleFlag,
4626              "-" as rule_nm length = 58,
4627              a.actual_dlvry_date as ad_dt,
4628              a.imb_code length = 31,
4629              "-" as rule_order,
4630              a.imb_dlvry_zip_5
4631      from ods_iv_recon_selected_mp as a
4632      where imb_dlvry_zip_5=&amp;amp;ZIP5_QUOTED
SYMBOLGEN:  Macro variable ZIP5_QUOTED resolves to '00926'
4633      union all corresponding
4634      select  *,
4635              "B" as source,
4636              "-" as RuleFlag,
4637              "-" as rule_nm length = 58,
4638              b.actual_dlvry_date as ad_dt,
4639              b.imb_code length = 31,
4640              "-" as rule_order,
4641              b.imb_dlvry_zip_5
4642      from ods_bi_recon_selected_mp as b
4643      where imb_dlvry_zip_5=&amp;amp;ZIP5_QUOTED;
SYMBOLGEN:  Macro variable ZIP5_QUOTED resolves to '00926'
ERROR: Duplicate column names have been detected in the above query which requested that CORRESPONDING column names be
       matched. This situation is ambiguous.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
4644      quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291895#M60500</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-16T13:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help: ERROR: Duplicate column names have been detected in the above query which requested that C</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291905#M60501</link>
      <description>&lt;P&gt;Review your input datasets and the columns in there. Since you use select *, all columns from the datasets will be taken, and one or more of them might have the same name as a new column you specified.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 13:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291905#M60501</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-16T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help: ERROR: Duplicate column names have been detected in the above query which requested that C</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291906#M60502</link>
      <description>&lt;P&gt;Your problem will derive form the use of:&lt;/P&gt;
&lt;P&gt;select *&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What this means it that you take every variable from all incoming datasets. &amp;nbsp;Then you are selecting at least one variable a second time:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;imb_dlvry_zip_5&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the select * will pull in a.imb_dlvry_zip_5 and so will that line in your code, hence you end up with duplicate variables.&lt;/P&gt;
&lt;P&gt;Unless there is a specific reason to do so, I would not use select *, it is sloppy coding. &amp;nbsp;You, the owner of the data and the one who know what they want should specify each and every column you want to find in your output table. &amp;nbsp;Then, if things change with the table your code does not.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291906#M60502</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-16T14:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help: ERROR: Duplicate column names have been detected in the above query which requested that C</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291925#M60506</link>
      <description>&lt;P&gt;hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are using "select *" the individual column names are not visible&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add the FEEDBACK option to Proc SQL like so&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc SQL feedback;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will then provide the actual select statement as it is processed with all the variable names written out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this should help with finding duplicate names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also create a table from your individual select statements like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql feedback;
  create table sample as
  select
    *
    , age as age
  from
    sashelp.class
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log will then show which variable names arew duplicates&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 15:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-ERROR-Duplicate-column-names-have-been-detected-in-the/m-p/291925#M60506</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-08-16T15:08:12Z</dc:date>
    </item>
  </channel>
</rss>

