<?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: prevent warning message when merge in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753424#M237451</link>
    <description>&lt;P&gt;If you use the Proc SQL Feedback option....&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql feedback;
  create table wanted as
    select a.*,b.*
    from t1 a
    left join t2 b
    on a.CustomerID=b.CustomerID
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...you see in the SAS Log select * resolved:&lt;/P&gt;
&lt;P&gt;select &lt;FONT color="#FF0000"&gt;A.CustomerID&lt;/FONT&gt;, A.X, B&lt;FONT color="#FF0000"&gt;.CustomerID&lt;/FONT&gt;, B.Y&lt;BR /&gt;from WORK.T1 A left outer join WORK.T2 B on A.CustomerID = B.CustomerID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...and it's just not conformant SQL to have the same named column twice in the select clause. So SAS is totally right to issue a warning ...and actually SAS is too tolerant imho. If it was me then this would result in an error condition as if ignoring the warning you risk to pick the column from the wrong table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In regards of the SQL feedback option: If there are many columns then I sometimes use it to generate the resolved select clause in the SAS log, copy/paste this into Notepad++, run some search/replace over it (replace comma with comma and newline), potentially remove the "duplicate" columns and then copy the result back into my SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jul 2021 05:13:54 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-07-12T05:13:54Z</dc:date>
    <item>
      <title>prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753422#M237449</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;what is the way that SAS will not show me the warning message&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WARNING: Variable CustomerID&amp;nbsp; already exists on file WORK.t2&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data t1;
input CustomerID X;
1 10
2 20
3 30
;
Run;

Data t2;
input CustomerID Y;
1 25
2 40
3 50
;
Run;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table wanted as&lt;BR /&gt;select a.*,b.*&lt;BR /&gt;from t1 a&lt;BR /&gt;left join t2 b&lt;BR /&gt;on a.CustomerID=b.CustomerID;&lt;BR /&gt;run;&lt;BR /&gt;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 04:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753422#M237449</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-07-12T04:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753423#M237450</link>
      <description>&lt;P&gt;Do not use asterisks, use explicit lists of variables (for at least one of the two datasets).&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 04:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753423#M237450</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-12T04:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753424#M237451</link>
      <description>&lt;P&gt;If you use the Proc SQL Feedback option....&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql feedback;
  create table wanted as
    select a.*,b.*
    from t1 a
    left join t2 b
    on a.CustomerID=b.CustomerID
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...you see in the SAS Log select * resolved:&lt;/P&gt;
&lt;P&gt;select &lt;FONT color="#FF0000"&gt;A.CustomerID&lt;/FONT&gt;, A.X, B&lt;FONT color="#FF0000"&gt;.CustomerID&lt;/FONT&gt;, B.Y&lt;BR /&gt;from WORK.T1 A left outer join WORK.T2 B on A.CustomerID = B.CustomerID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...and it's just not conformant SQL to have the same named column twice in the select clause. So SAS is totally right to issue a warning ...and actually SAS is too tolerant imho. If it was me then this would result in an error condition as if ignoring the warning you risk to pick the column from the wrong table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In regards of the SQL feedback option: If there are many columns then I sometimes use it to generate the resolved select clause in the SAS log, copy/paste this into Notepad++, run some search/replace over it (replace comma with comma and newline), potentially remove the "duplicate" columns and then copy the result back into my SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 05:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753424#M237451</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-12T05:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753439#M237461</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table wanted as
        select coalesce(a.customerid,b.customerid) as customerid,
               x, y
        from t1 a
        left join t2 b
        on a.CustomerID=b.CustomerID;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 08:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753439#M237461</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-07-12T08:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753440#M237462</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184742"&gt;@xxformat_com&lt;/a&gt;&amp;nbsp;Given that this is a left join on customerid, a.customerid will always be populated (or both columns will be missing) so no reason for a coalesce() function. It should just be a.customerid in the select clause.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 08:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753440#M237462</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-12T08:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753464#M237474</link>
      <description>True Patrick and I shouldn't try to do to things at the same time.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table wanted as&lt;BR /&gt;select a.*, y&lt;BR /&gt;from t1 a&lt;BR /&gt;left join t2 b&lt;BR /&gt;on a.CustomerID=b.CustomerID;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jul 2021 11:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753464#M237474</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2021-07-12T11:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: prevent warning message when merge in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753471#M237480</link>
      <description>Add NOWARN option:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql nowarn;&lt;BR /&gt;create table wanted as&lt;BR /&gt;select a.*,b.*&lt;BR /&gt;from t1 a left join t2 b on a.CustomerID=b.CustomerID;&lt;BR /&gt;quit;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jul 2021 12:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/prevent-warning-message-when-merge-in-proc-sql/m-p/753471#M237480</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-12T12:16:55Z</dc:date>
    </item>
  </channel>
</rss>

