<?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 CREATE TABLE AS SELECT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171031#M44184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When i use the command below, a new table is generated, however the sas index file is not generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table x (compress=char) as select * from y;&lt;/P&gt;&lt;P&gt;** y has a index file &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there some command to create a table from another, generating the index file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some tables that are becoming very large because of deletes operations.&lt;/P&gt;&lt;P&gt;SAS has not command to rebuild a table, so I need to do this recreation once a week automatically, and should not fail if you create a new field in the table, for example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Jan 2015 18:31:41 GMT</pubDate>
    <dc:creator>DavidCaliman</dc:creator>
    <dc:date>2015-01-06T18:31:41Z</dc:date>
    <item>
      <title>CREATE TABLE AS SELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171031#M44184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When i use the command below, a new table is generated, however the sas index file is not generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table x (compress=char) as select * from y;&lt;/P&gt;&lt;P&gt;** y has a index file &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there some command to create a table from another, generating the index file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some tables that are becoming very large because of deletes operations.&lt;/P&gt;&lt;P&gt;SAS has not command to rebuild a table, so I need to do this recreation once a week automatically, and should not fail if you create a new field in the table, for example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 18:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171031#M44184</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2015-01-06T18:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE TABLE AS SELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171032#M44185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First off, you can just rebuild the index, of course.&amp;nbsp; If you're deleting significant numbers of records, you probably should do that anyway.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, PROC COPY will copy indexes AND will remove empty space.&amp;nbsp; However, in addition to the warning that preserving indexes isn't great when a lot of rows are being removed, it also requires you to copy from one library to another.&amp;nbsp; Perhaps there's a way around that, I'm not sure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume your concern here is that the index file itself may have been changed?&amp;nbsp; Otherwise this is fairly straightforward (ie, option 1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jan 2015 19:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171032#M44185</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2015-01-06T19:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE TABLE AS SELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171033#M44186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The following could work ?&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;create table x (compress=char &lt;STRONG&gt;index=xx&lt;/STRONG&gt;) as select * from y;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 05:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171033#M44186</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-07T05:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE TABLE AS SELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171034#M44187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it works. See below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table class(compress=char index=(name)) as select * from sashelp.class;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 16:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171034#M44187</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2015-01-07T16:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE TABLE AS SELECT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171035#M44188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the following and it works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc copy in=lib1 out=lib2 CONSTRAINT=YES INDEX=YES;&lt;/P&gt;&lt;P&gt;select y;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 18:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CREATE-TABLE-AS-SELECT/m-p/171035#M44188</guid>
      <dc:creator>DavidCaliman</dc:creator>
      <dc:date>2015-01-07T18:01:55Z</dc:date>
    </item>
  </channel>
</rss>

