<?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 A warning in PROC SQL. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/A-warning-in-PROC-SQL/m-p/24287#M5492</link>
    <description>I have TAB1 with some variables. One of them is an identity variabel, called ID. In TAB2 I have only the variabel ID. I want to create TAB3, with records from TAB1, for the identities found in TAB2. The code below runs, but I get a warning:&lt;BR /&gt;
&lt;BR /&gt;
WARNING: Variable ID already exists on file WORK.TAB3.&lt;BR /&gt;
&lt;BR /&gt;
Q1: Why do I get that warning?&lt;BR /&gt;
&lt;BR /&gt;
Q2: Is my code correct for the purpose I have described?&lt;BR /&gt;
&lt;BR /&gt;
My code:&lt;BR /&gt;
&lt;BR /&gt;
&lt;I&gt;proc sql;&lt;BR /&gt;
create table tab3 as&lt;BR /&gt;
select * from tab1, tab2&lt;BR /&gt;
where tab1.id=tab2.id;&lt;BR /&gt;
quit;&lt;/I&gt;</description>
    <pubDate>Tue, 28 Apr 2009 09:18:58 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-28T09:18:58Z</dc:date>
    <item>
      <title>A warning in PROC SQL.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-warning-in-PROC-SQL/m-p/24287#M5492</link>
      <description>I have TAB1 with some variables. One of them is an identity variabel, called ID. In TAB2 I have only the variabel ID. I want to create TAB3, with records from TAB1, for the identities found in TAB2. The code below runs, but I get a warning:&lt;BR /&gt;
&lt;BR /&gt;
WARNING: Variable ID already exists on file WORK.TAB3.&lt;BR /&gt;
&lt;BR /&gt;
Q1: Why do I get that warning?&lt;BR /&gt;
&lt;BR /&gt;
Q2: Is my code correct for the purpose I have described?&lt;BR /&gt;
&lt;BR /&gt;
My code:&lt;BR /&gt;
&lt;BR /&gt;
&lt;I&gt;proc sql;&lt;BR /&gt;
create table tab3 as&lt;BR /&gt;
select * from tab1, tab2&lt;BR /&gt;
where tab1.id=tab2.id;&lt;BR /&gt;
quit;&lt;/I&gt;</description>
      <pubDate>Tue, 28 Apr 2009 09:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-warning-in-PROC-SQL/m-p/24287#M5492</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-28T09:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: A warning in PROC SQL.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-warning-in-PROC-SQL/m-p/24288#M5493</link>
      <description>While you merge the datasets thru. proc sql code, the identical variables are not overwritten, unlike datastep merge. This can be visualized when this code is run removing the "Create table tab3 as" statement.&lt;BR /&gt;
&lt;BR /&gt;
It is rationale that the variable's name should be unique.&lt;BR /&gt;
&lt;BR /&gt;
So, you can do either of the following.&lt;BR /&gt;
&lt;BR /&gt;
A)  Select variables explicitly from the datasets.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table tab3 as&lt;BR /&gt;
select  a.id, a.&lt;OTHER variables=""&gt; from tab1 a,  tab2 b&lt;BR /&gt;
where a.id=b.id;&lt;BR /&gt;
quit; &lt;BR /&gt;
&lt;BR /&gt;
By this way, you are not asking SAS to keep two "ID" variables, which it wont.&lt;BR /&gt;
&lt;BR /&gt;
B) Using datastep merge.&lt;BR /&gt;
&lt;BR /&gt;
Hope this is is useful.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;/OTHER&gt;</description>
      <pubDate>Tue, 28 Apr 2009 10:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-warning-in-PROC-SQL/m-p/24288#M5493</guid>
      <dc:creator>msg</dc:creator>
      <dc:date>2009-04-28T10:03:26Z</dc:date>
    </item>
  </channel>
</rss>

