<?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 various datasets in one step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674396#M23540</link>
    <description>&lt;P&gt;Maybe try like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data_1 data_2 data_3 data_1000;
  set SASHELP.CLASS;  
run;

proc sql noprint;
  select catx(".", libname, memname)
  into :dataset_list separated by " "
  from dictionary.tables
  where memname like 'DATA%'
  ;
quit;

%put *&amp;amp;dataset_list.*;

proc delete data = &amp;amp;dataset_list.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Tue, 04 Aug 2020 15:29:25 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2020-08-04T15:29:25Z</dc:date>
    <item>
      <title>Delete various datasets in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674389#M23537</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem to delete some datasets in one step. I have various datasets in my work library with the same name and different numbers (e.g. data_1, data_2, data_3, ...). I would like to delete all datasets which start with the term "data".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already tried to use PROC Delete, but something is missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very grateful if someone has an idea.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Delete Data= Data: ;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 15:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674389#M23537</guid>
      <dc:creator>Tim_sas_</dc:creator>
      <dc:date>2020-08-04T15:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delete various datasets in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674393#M23538</link>
      <description>&lt;P&gt;According to the doc. for proc delete:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV class="xis-procStatement"&gt;
&lt;DIV class="xis-procStatementSyntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-requiredArgGroup"&gt;
&lt;DIV id="n07peoefoh5wron164xe3agbphvb" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;DATA= &lt;SPAN class="xis-userSuppliedValue"&gt;SAS-file(s)&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies one or more SAS files that you want to delete.&lt;/P&gt;
&lt;DIV id="p180526b2csg4vn10qx5s30wsivv" class="xis-note"&gt;&lt;SPAN class="xis-noteGenText"&gt;Note: &lt;/SPAN&gt;You can also use a numbered range list. &lt;SPAN class="xis-xrefSee"&gt;&lt;SPAN class="xis-xrefText"&gt;For more information, see &lt;/SPAN&gt;&lt;A href="http:// " target="_self"&gt;Data Set Lists&lt;/A&gt; in &lt;SPAN class="xis-xrefBookTitle"&gt;SAS Language Reference: Concepts&lt;/SPAN&gt;&lt;SPAN class="xis-xrefText"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;STRONG&gt;You cannot use a colon list.&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="xis-note"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-note"&gt;Bart&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Aug 2020 15:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674393#M23538</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-08-04T15:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Delete various datasets in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674395#M23539</link>
      <description>&lt;P&gt;Do this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data_1; a=1; run;
data data_2; a=1; run;
data data_3; a=1; run;

proc datasets library=work nolist;
   delete data_:;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 15:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674395#M23539</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-08-04T15:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Delete various datasets in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674396#M23540</link>
      <description>&lt;P&gt;Maybe try like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data_1 data_2 data_3 data_1000;
  set SASHELP.CLASS;  
run;

proc sql noprint;
  select catx(".", libname, memname)
  into :dataset_list separated by " "
  from dictionary.tables
  where memname like 'DATA%'
  ;
quit;

%put *&amp;amp;dataset_list.*;

proc delete data = &amp;amp;dataset_list.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 15:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674396#M23540</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-08-04T15:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Delete various datasets in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674399#M23541</link>
      <description>&lt;P&gt;Just a caveat with data set lists using a colon. You cannot use them in a DATA= location but you can in other places.&lt;/P&gt;
&lt;P&gt;FYI unfortunately the link you're including doesn't seem to work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;According to the doc. for proc delete:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV class="xis-procStatement"&gt;
&lt;DIV class="xis-procStatementSyntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-requiredArgGroup"&gt;
&lt;DIV id="n07peoefoh5wron164xe3agbphvb" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;DATA= &lt;SPAN class="xis-userSuppliedValue"&gt;SAS-file(s)&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies one or more SAS files that you want to delete.&lt;/P&gt;
&lt;DIV id="p180526b2csg4vn10qx5s30wsivv" class="xis-note"&gt;&lt;SPAN class="xis-noteGenText"&gt;Note: &lt;/SPAN&gt;You can also use a numbered range list. &lt;SPAN class="xis-xrefSee"&gt;&lt;SPAN class="xis-xrefText"&gt;For more information, see &lt;/SPAN&gt;&lt;A href="http:// " target="_self"&gt;Data Set Lists&lt;/A&gt; in &lt;SPAN class="xis-xrefBookTitle"&gt;SAS Language Reference: Concepts&lt;/SPAN&gt;&lt;SPAN class="xis-xrefText"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;STRONG&gt;You cannot use a colon list.&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="xis-note"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-note"&gt;Bart&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 15:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674399#M23541</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-04T15:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Delete various datasets in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674438#M23542</link>
      <description>&lt;P&gt;PROC DELETE only allows numeric lists, not the colon wildcard suffix.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are gaps in the numbers or don't know the exact range you could try just using a larger number than you expect to have.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc delete data=data_1-data_100; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you will get warning message for the datasets that do not exist.&lt;/P&gt;
&lt;P&gt;You could instead use PROC DATASETS as it does allow the colon wildcard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;1050  data data1 data2 data3 data100 ;
1051  run;

NOTE: The data set WORK.DATA1 has 1 observations and 0 variables.
NOTE: The data set WORK.DATA2 has 1 observations and 0 variables.
NOTE: The data set WORK.DATA3 has 1 observations and 0 variables.
NOTE: The data set WORK.DATA100 has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


1052  proc datasets nolist nowarn lib=work;
1053      delete data: ;
1054  run;

NOTE: Deleting WORK.DATA1 (memtype=DATA).
NOTE: Deleting WORK.DATA100 (memtype=DATA).
NOTE: Deleting WORK.DATA2 (memtype=DATA).
NOTE: Deleting WORK.DATA3 (memtype=DATA).
1055  quit;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 16:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-various-datasets-in-one-step/m-p/674438#M23542</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-04T16:41:51Z</dc:date>
    </item>
  </channel>
</rss>

