<?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: Delete iterated Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373877#M89451</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;proc datasets lib=WORK;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; delete TAB1-TAB12 TAB14-TAB30;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2017 10:29:40 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2017-07-07T10:29:40Z</dc:date>
    <item>
      <title>Delete iterated Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373863#M89445</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created tables in a do loop (e.g. Table_1 to Table_30&amp;nbsp; ) and I would like to keep only one, let's say Table_13. How can I delete the other tables in a simple way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 09:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373863#M89445</guid>
      <dc:creator>adil256</dc:creator>
      <dc:date>2017-07-07T09:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Delete iterated Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373875#M89449</link>
      <description>&lt;P&gt;It might be possible to adjust the program so it only creates the data sets you need. &amp;nbsp;But assuming that is either not possible or not desirable, use PROC DATASETS. &amp;nbsp;This is untested, but should be easily fixable if need be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets library=work;&lt;/P&gt;
&lt;P&gt;delete table_1 - table_12;&lt;/P&gt;
&lt;P&gt;delete table_14 - table_30;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 10:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373875#M89449</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-07T10:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delete iterated Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373876#M89450</link>
      <description>&lt;P&gt;Why have you create 30 tables in the first place? &amp;nbsp;If you only want one dataset at the end, create only the one dataset, otherwise its just wasting resources and disk space.&lt;/P&gt;
&lt;P&gt;Also, need to state the logic for why _13 should remain. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 10:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373876#M89450</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-07T10:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Delete iterated Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373877#M89451</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;proc datasets lib=WORK;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; delete TAB1-TAB12 TAB14-TAB30;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 10:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373877#M89451</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-07-07T10:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete iterated Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373879#M89453</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wanted to make this a little more automated you could use the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table_1 table_2 table_3 table_4 table_5 table_6;
    x=1;
run;

%let keep_table = TABLE_3;

proc sql noprint;
    select memname into :drop_tables separated by " "
    from sashelp.vcolumn 
    where libname = "WORK" and 
          memname like "TABLE_%" and
          memname ^= "&amp;amp;keep_table";
quit;

proc datasets;
    delete &amp;amp;drop_tables;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This way it doesn't matter how many datasets you create, you only need to specify the single table you want to keep (and if you have a rule for which table you want to keep you can use this to define the "keep_table" macro variable).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 10:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/373879#M89453</guid>
      <dc:creator>BenbowL</dc:creator>
      <dc:date>2017-07-07T10:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Delete iterated Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/374833#M89801</link>
      <description>Sorry for late response. It's exactly what i wanted to do. It does the job perfectly.&lt;BR /&gt;I thought it was possible to exclude a vairable like this : var1-var10 except var3.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&lt;BR /&gt;I need to create the table before to retrieve the statistic from fastclus procedure. Then based on the statistic parameters, I only choose one.&lt;BR /&gt;&lt;BR /&gt;Thank you guys for your quick answers. Have a good day.</description>
      <pubDate>Tue, 11 Jul 2017 08:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-iterated-Table/m-p/374833#M89801</guid>
      <dc:creator>adil256</dc:creator>
      <dc:date>2017-07-11T08:16:29Z</dc:date>
    </item>
  </channel>
</rss>

