<?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: how to delete date suffixed files in a location in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608563#M177125</link>
    <description>&lt;P&gt;A subject line alone is insufficient to provide us with enough information for your question.&lt;/P&gt;
&lt;P&gt;Please provide much more detailed information like: Are you talking about SAS tables in a library or some other files on the file system? Unix/Linux or Windows - OS? SAS version?&lt;/P&gt;
&lt;P&gt;HOW does the naming pattern look like. Where is the date part in the name and what sort of logic would you required to delete the files (like: older than x days based on current system date)?&lt;/P&gt;
&lt;P&gt;Provide some sample data / actual file names showing the actual naming pattern you're dealing with.&lt;/P&gt;</description>
    <pubDate>Sun, 01 Dec 2019 20:55:35 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-12-01T20:55:35Z</dc:date>
    <item>
      <title>how to delete date suffixed files in a location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608562#M177124</link>
      <description />
      <pubDate>Sun, 01 Dec 2019 09:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608562#M177124</guid>
      <dc:creator>suhas1</dc:creator>
      <dc:date>2019-12-01T09:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete date suffixed files in a location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608563#M177125</link>
      <description>&lt;P&gt;A subject line alone is insufficient to provide us with enough information for your question.&lt;/P&gt;
&lt;P&gt;Please provide much more detailed information like: Are you talking about SAS tables in a library or some other files on the file system? Unix/Linux or Windows - OS? SAS version?&lt;/P&gt;
&lt;P&gt;HOW does the naming pattern look like. Where is the date part in the name and what sort of logic would you required to delete the files (like: older than x days based on current system date)?&lt;/P&gt;
&lt;P&gt;Provide some sample data / actual file names showing the actual naming pattern you're dealing with.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2019 20:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608563#M177125</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-12-01T20:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete date suffixed files in a location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608567#M177128</link>
      <description>&lt;P&gt;i am having sas tables in a library.some filenames start like 15011990(ddmmyyyy)pattern.some filenames like custseg01 like that .i want to delete datesuffix files in that particular location&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 01 Dec 2019 11:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608567#M177128</guid>
      <dc:creator>suhas1</dc:creator>
      <dc:date>2019-12-01T11:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete date suffixed files in a location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608589#M177141</link>
      <description>&lt;P&gt;If the pattern as at the beginning it would be easier as SAS allows the use of colon as a wildcard for the end of a name.&lt;/P&gt;
&lt;P&gt;To search for pattern at the end you will need to get the list of names as data and search that.&lt;/P&gt;
&lt;P&gt;So you could use PROC CONTENTS output or the DICTIONARY.TABLES or DICTIONARY.MEMBERS metadata tables to get the names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib 'my directory name';
proc contents data=mylib._all_ noprint out=contents; run;
data names ;
  set contents;
  by memname ;
  if first.memname;
  keep memname libname;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now that you have all of the names of the datasets in that directory.&amp;nbsp; You can then use some code to find the ones you want to delete and then generate code to delete them.&amp;nbsp; For example to delete any dataset where the last 8 characters are a valid date in DDMMYYYY style.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set names ;
  if length(memname) &amp;gt; 8
  and input(substr(memname,length(memname-7)),??ddmmyy8.) ne . then do;
    call execute(catx(' ','proc delete data=',catx('.',libname,memname),';run;'));
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Dec 2019 17:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-delete-date-suffixed-files-in-a-location/m-p/608589#M177141</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-01T17:38:21Z</dc:date>
    </item>
  </channel>
</rss>

