<?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: Simple creation of a table with SQL? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234461#M42878</link>
    <description>&lt;P&gt;ok to explain , please try to pull the required variables only from one dataset. if there are common variables between two datasets then try to pull required variables from only one dataset. since you kep b.* and a.* even the common variables are pulled from both the datasets. So try a.* and b.specific variable names from other datasets. So that you will not get those warnings.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Nov 2015 19:48:39 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2015-11-12T19:48:39Z</dc:date>
    <item>
      <title>Simple creation of a table with SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234442#M42876</link>
      <description>&lt;P&gt;I was joining two simple tables that reside on an SQL server and thought I would check if there was a difference if I named the parent table first or second. There was and I can't figure out why. Can anyone help please?&lt;/P&gt;
&lt;P&gt;I am also wondering what happens when variables have the same name?&lt;/P&gt;
&lt;P&gt;Here is the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;proc sql noprint;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;create table cmd1 as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;select b.*, a.*&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;from cmdclaim.claim a, cmdclaim.claimdetail b&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;where b.claimid=a.claimid&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;order by a.claimid;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable ClaimID already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable DiagnosticCode already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable ModifiedDate already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable CreatedDate already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: Table WORK.CMD1 created, with&lt;U&gt; 50788&lt;/U&gt; rows and 48 columns.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;16 quit;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; real time 15.14 seconds&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; cpu time 3.41 seconds&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;STRONG&gt;proc sql noprint;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;create table cmd1 as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;select b.*, a.*&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;from cmdclaim.claim a, cmdclaim.claimdetail b&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;where a.claimid=b.claimid&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;order by a.claimid;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable ClaimID already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable DiagnosticCode already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable ModifiedDate already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable CreatedDate already exists on file WORK.CMD1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: Table WORK.CMD1 created, with &lt;U&gt;50811&lt;/U&gt; rows and 48 columns.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;23 quit;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: PROCEDURE SQL used (Total process time):&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; real time 14.73 seconds&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; cpu time 3.54 seconds&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate any help understanding the difference in the results.&lt;/P&gt;
&lt;P&gt;Sally&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 18:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234442#M42876</guid>
      <dc:creator>SallyS</dc:creator>
      <dc:date>2015-11-12T18:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Simple creation of a table with SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234461#M42878</link>
      <description>&lt;P&gt;ok to explain , please try to pull the required variables only from one dataset. if there are common variables between two datasets then try to pull required variables from only one dataset. since you kep b.* and a.* even the common variables are pulled from both the datasets. So try a.* and b.specific variable names from other datasets. So that you will not get those warnings.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 19:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234461#M42878</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-11-12T19:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Simple creation of a table with SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234480#M42880</link>
      <description>What kind of join are you doing and what kind did you intend to do?</description>
      <pubDate>Thu, 12 Nov 2015 20:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234480#M42880</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-11-12T20:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Simple creation of a table with SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234489#M42883</link>
      <description>&lt;P&gt;To add to what has been said already:&lt;/P&gt;
&lt;P&gt;1. Use option "&lt;SPAN&gt;options sastrace=',,,d' sastraceloc=saslog &lt;/SPAN&gt;&lt;EM&gt;nostsuffix&lt;/EM&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;" to see in the log what SQL syntax can get sent to the DBMS.&lt;/P&gt;
&lt;P&gt;2. Use option "fullstimer" to get a bit more timing information in the log.&lt;/P&gt;
&lt;P&gt;3. Use "feedback" to see in the log if SAS changes the syntax: Proc SQL feedback; ....&lt;/P&gt;
&lt;P&gt;5. That the two queries return a different number of rows is concerning and the only explanation I'm having is that you had a different number of rows in your source tables when you executed them&lt;/P&gt;
&lt;P&gt;5. CPU and Real Times are not always the same between two&amp;nbsp;runs even for exactly the same syntax. To really see if there is a difference between two SQL code versions you would have to execute them multiple times.&lt;/P&gt;
&lt;P&gt;6. If you want to dig deeper then copy the SQL syntax sent to the DBMS from the log and analyze it further using&amp;nbsp;sql server management studio&amp;nbsp;&lt;A href="https://technet.microsoft.com/en-us/library/ms191227(v=sql.105).aspx" target="_blank"&gt;https://technet.microsoft.com/en-us/library/ms191227(v=sql.105).aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 22:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234489#M42883</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-11-12T22:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Simple creation of a table with SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234506#M42888</link>
      <description>&lt;P&gt;This is unexpected. Both results should have the same number of obs. Unless the tables were modified between the two queries. Did you try running the first query again?&lt;/P&gt;
&lt;P&gt;The query is most likely run on the server. So you may be looking at &lt;STRIKE&gt;peculiarities&lt;/STRIKE&gt; features of SQL Server.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeated names are removed from the select list. That should not affect the number of obs, unless you are using DISTINCT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 21:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-creation-of-a-table-with-SQL/m-p/234506#M42888</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-12T21:41:52Z</dc:date>
    </item>
  </channel>
</rss>

