<?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 PROC SQL - How to create a table, i am selecting in the same step? in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282407#M8055</link>
    <description>&lt;P&gt;Hello SAS Community.&lt;/P&gt;&lt;P&gt;I have a hopefully easier problem to solve for you:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;&lt;BR /&gt;&lt;BR /&gt;CREATE TABLE rawdat.detail AS
	SELECT a.*
	FROM rawdat.detail  AS a INNER JOIN
     	rawdat.product AS B &lt;BR /&gt;     	ON a.case_id = b.case_id AND a.seq_id = b.id&lt;BR /&gt;	ORDER BY x, y, z;

QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My Problem is, that i wand to modify the table i am reading in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could solve the problem with creating another table, but thats not what i am looking for.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2016 13:17:24 GMT</pubDate>
    <dc:creator>Felix_</dc:creator>
    <dc:date>2016-07-06T13:17:24Z</dc:date>
    <item>
      <title>PROC SQL - How to create a table, i am selecting in the same step?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282407#M8055</link>
      <description>&lt;P&gt;Hello SAS Community.&lt;/P&gt;&lt;P&gt;I have a hopefully easier problem to solve for you:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;&lt;BR /&gt;&lt;BR /&gt;CREATE TABLE rawdat.detail AS
	SELECT a.*
	FROM rawdat.detail  AS a INNER JOIN
     	rawdat.product AS B &lt;BR /&gt;     	ON a.case_id = b.case_id AND a.seq_id = b.id&lt;BR /&gt;	ORDER BY x, y, z;

QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My Problem is, that i wand to modify the table i am reading in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could solve the problem with creating another table, but thats not what i am looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 13:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282407#M8055</guid>
      <dc:creator>Felix_</dc:creator>
      <dc:date>2016-07-06T13:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - How to create a table, i am selecting in the same step?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282468#M8056</link>
      <description>&lt;P&gt;You can modify the existing table but you would get warning in logs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are okay with warning then go ahead.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 16:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282468#M8056</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-07-06T16:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - How to create a table, i am selecting in the same step?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282626#M8058</link>
      <description>&lt;P&gt;Hello RahulG, thanks for the response.&lt;BR /&gt;The warning in the log-file is exactly my problem. I want to have a fast solution (with sql) with a clean log. Couldn't find the solution so far...&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 07:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282626#M8058</guid>
      <dc:creator>Felix_</dc:creator>
      <dc:date>2016-07-07T07:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL - How to create a table, i am selecting in the same step?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282630#M8059</link>
      <description>&lt;P&gt;Create table A ... from table A ... is simply not valid SQL - so don't do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a Delete instead "delete .... where not exists (...)" as this is actually the result of your inner join.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can't re-create the same table with a SQL you also can't resort it directly in-itself. You could create an index instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or -alternatively - you could do something as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CREATE view V_detail AS
    SELECT a.*
      FROM rawdat.detail  AS a 
        INNER JOIN
          rawdat.product AS B       
          ON a.case_id = b.case_id AND a.seq_id = b.id  
          ;
QUIT;

proc sort data=V_detail out=rawdat.detail;
  by x y z;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 07:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/PROC-SQL-How-to-create-a-table-i-am-selecting-in-the-same-step/m-p/282630#M8059</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-07-07T07:33:53Z</dc:date>
    </item>
  </channel>
</rss>

