<?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 warning in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133584#M36274</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The join is made on all matching (name, type) variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Mar 2013 21:13:10 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2013-03-13T21:13:10Z</dc:date>
    <item>
      <title>Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133580#M36270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody please help me to understand why I am getting warning message in the following proc sql?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 475&amp;nbsp; proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 476&amp;nbsp; create table all as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 477&amp;nbsp; select a.*, s.* from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 478&amp;nbsp; appended a, survey s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 479&amp;nbsp; where a.id=s.id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WARNING: Variable id already exists on file ALL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 20:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133580#M36270</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2013-03-13T20:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133581#M36271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's telling you that you have two variables that are the same between the two datasets. Considering you're joining on that field, you'd think it would be smart enough to know better. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's preferable practice to specify the join type and use on rather than where, and also faster by about 5-10% in my tests. You'll still get the warning though, unless you explicitly list one set of variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;create table all as&lt;/P&gt;&lt;P&gt;select a.*, s.* from&lt;/P&gt;&lt;P&gt;appended a,&lt;/P&gt;&lt;P&gt;inner join survey s&lt;/P&gt;&lt;P&gt;on a.id=s.id;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 20:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133581#M36271</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-03-13T20:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133582#M36272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you say a.*, s.* , you want all the variables from appended and all the variables from survey. But the variable id exists in both tables, and it cannot exist twice with the same name in table all. If id is the only variable in both datasets, you can try this instead :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table all as select * from appended natural join survey;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 21:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133582#M36272</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-03-13T21:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133583#M36273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What happens in a natural join if you have more than 1 matching variable name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 21:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133583#M36273</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-03-13T21:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133584#M36274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The join is made on all matching (name, type) variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 21:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133584#M36274</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-03-13T21:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133585#M36275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks PG!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is working without any error message. As you suggested if there are more than one matching variables in two datasets then SAS will join 2 datasets based on all matching variables. Just for my understanding how natural join works for more than one matching variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 00:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133585#M36275</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2013-03-14T00:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133586#M36276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Say you have dataset T1 with variables A, B, C, X and dataset T2 with variables A, B, C, Y then the query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select * from T1 natural join T2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is equivalent to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select T1.A, T1.B, T1,C, X, Y &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from T1 inner join T2 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on T1.A=T2.A and T1.B=T2.B and T1.C=T2.C;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 01:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133586#M36276</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-03-14T01:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133587#M36277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks PG!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it. SAS is taking name and type of the variables to declare them matching. If matching variables contain duplicate or missing values how these will be handled by SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 13:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133587#M36277</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2013-03-14T13:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133588#M36278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a vast subject. I recommend reading about all the available types of joins in SQL at :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p0o4a5ac71mcchn1kc1zhxdnm139.htm" title="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#p0o4a5ac71mcchn1kc1zhxdnm139.htm"&gt;SAS(R) 9.3 SQL Procedure User's Guide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and take some time to experiment on your own. The core concept (where you should start) is the cartesian product join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 15:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133588#M36278</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-03-14T15:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133589#M36279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is also a great read.&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sastraining/2013/02/04/a-database-professionals-best-friend-2/" title="http://blogs.sas.com/content/sastraining/2013/02/04/a-database-professionals-best-friend-2/"&gt;A database professional’s best friend - The SAS Training Post&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 15:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133589#M36279</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-03-14T15:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql warning</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133590#M36280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all for the helpful suggestions on this topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 16:30:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-warning/m-p/133590#M36280</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2013-03-14T16:30:15Z</dc:date>
    </item>
  </channel>
</rss>

