<?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: SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518174#M140199</link>
    <description>&lt;P&gt;&lt;SPAN&gt;The column that is kept is from the &lt;STRONG&gt;first&lt;/STRONG&gt; table in the from clause that contains that variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Unfortunately, you will have to type&amp;nbsp; like&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;select a.col1,a.col2,....a.coln , b.col,b.coln&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do not specify the key variable in b. series of col names&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Dec 2018 18:26:09 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-12-03T18:26:09Z</dc:date>
    <item>
      <title>SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518166#M140195</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;488! create table NACRS_AA_COSTsql as&lt;BR /&gt;489 select *&lt;BR /&gt;490 from NACRS_AA_1 as a, Costing_1 as b&lt;BR /&gt;491 where a.CIHI_KEY=b.CIHI_KEY&lt;BR /&gt;492 ;&lt;BR /&gt;&lt;STRONG&gt;WARNING: Variable CIHI_KEY already exists on file WORK.NACRS_AA_COSTSQL.&lt;/STRONG&gt;&lt;BR /&gt;NOTE: Table WORK.NACRS_AA_COSTSQL created, with 1171 rows and 81 columns.&lt;/P&gt;&lt;P&gt;493 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.39 seconds&lt;BR /&gt;cpu time 0.39 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello Can someone please advise why I get the warning message&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 18:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518166#M140195</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-03T18:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518170#M140196</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;Hello Can someone please advise why I get the warning message"&amp;nbsp; -- this is because&amp;nbsp;of the &lt;STRONG&gt;ambiguity&lt;/STRONG&gt; for the sql processor to determine which&amp;nbsp;&lt;STRONG&gt;CIHI_KEY&amp;nbsp;&lt;/STRONG&gt;for select clause to pick as that column is present in both your tables referred in from clause.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://support.sas.com/kb/9/963.html" target="_blank"&gt;http://support.sas.com/kb/9/963.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, try to avoid using * in production code as far as possible.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 18:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518170#M140196</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-03T18:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518172#M140198</link>
      <description>thankyou in this case the ihikey is picked from which table ?&lt;BR /&gt;Alsohw would i specify to select cihikey from one table but i also need all the columns from both tables&lt;BR /&gt;I dont have training in sql so asking basic q's</description>
      <pubDate>Mon, 03 Dec 2018 18:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518172#M140198</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-03T18:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518174#M140199</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The column that is kept is from the &lt;STRONG&gt;first&lt;/STRONG&gt; table in the from clause that contains that variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Unfortunately, you will have to type&amp;nbsp; like&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;select a.col1,a.col2,....a.coln , b.col,b.coln&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do not specify the key variable in b. series of col names&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 18:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518174#M140199</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-03T18:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518177#M140202</link>
      <description>Try the FEEDBACK option. Add it to the PROC SQL statement and then check your log. You can copy the query and use that instead. &lt;BR /&gt;&lt;BR /&gt;Proc sql feedback;&lt;BR /&gt;Create table want as&lt;BR /&gt;Select *&lt;BR /&gt;From sashelp.class as a, sashelp.class as b&lt;BR /&gt;Where a.name=b.name;&lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;This is a useless query but should illustrate your issue.</description>
      <pubDate>Mon, 03 Dec 2018 18:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518177#M140202</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-03T18:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518208#M140218</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you CAN avoid&amp;nbsp;extensive variable lists and preserve usage of "select *" with judicious use of the data set name parameters RENAME and DROP.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 create table NACRS_AA_COSTsql (drop=key2) as
 select *
   from NACRS_AA_1 as a, Costing_1 (rename=(cihi_key=key2)) as b
   where a.CIHI_KEY=b.KEY2
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Dec 2018 19:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518208#M140218</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-12-03T19:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518209#M140219</link>
      <description>&lt;P&gt;Nice idea &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 19:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518209#M140219</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-03T19:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518210#M140220</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;&amp;nbsp; To what you wrote as basic, doesn't seem basic anymore considering you take a look at &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;Mark's idea, i.e slick use of dataset options and elegantly keeping *&amp;nbsp; to select all.&amp;nbsp; I hope you took note of that as I did.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 19:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518210#M140220</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-03T19:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518229#M140227</link>
      <description>thankyou&lt;BR /&gt;I am getting an error&lt;BR /&gt;proc sql;&lt;BR /&gt;102! create table NACRS_AA_COSTsql (drop=key2) as&lt;BR /&gt;103 select *&lt;BR /&gt;104 from NACRS_AA_1 as a, Costing_1 as b (rename=(CIHI_KEY=key2))&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: GROUP, HAVING, ORDER, WHERE.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;105 where a.CIHI_KEY=b.key2&lt;BR /&gt;106 ;&lt;BR /&gt;107 quit;&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Dec 2018 21:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518229#M140227</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-03T21:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518235#M140230</link>
      <description>&lt;P&gt;Dataset option should follow dataset and not the alias &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Costing_1 (rename=(CIHI_KEY=key2)) as b&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Dec 2018 21:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518235#M140230</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-03T21:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518238#M140231</link>
      <description>Many thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 03 Dec 2018 21:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518238#M140231</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-03T21:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518239#M140232</link>
      <description>Thankyou !!</description>
      <pubDate>Mon, 03 Dec 2018 21:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518239#M140232</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-03T21:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518240#M140233</link>
      <description>Thankyou</description>
      <pubDate>Mon, 03 Dec 2018 21:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL/m-p/518240#M140233</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-03T21:37:08Z</dc:date>
    </item>
  </channel>
</rss>

