<?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: Automation Help - Parsing the most recent file in a folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75988#M16392</link>
    <description>The timestamp is included in the file name&lt;BR /&gt;
&lt;BR /&gt;
e.g. _2009-02-16-07-34-32.txt&lt;BR /&gt;
&lt;BR /&gt;
Alternatively, it could also be the latest file in the directory.</description>
    <pubDate>Mon, 02 Mar 2009 22:58:01 GMT</pubDate>
    <dc:creator>Mahesh_K</dc:creator>
    <dc:date>2009-03-02T22:58:01Z</dc:date>
    <item>
      <title>Automation Help - Parsing the most recent file in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75985#M16389</link>
      <description>I would be grateful if someone could help automate the task of a weekly job that I need to run every Monday.&lt;BR /&gt;
&lt;BR /&gt;
There are about 10 different files that an existing piece of code reads. All of these files are in a folder say D:\SASFILES. &lt;BR /&gt;
&lt;BR /&gt;
The issue is the file is dumped into this folder and the folder also has all historical dumps of the file. The latest file is identified by the latest time stamp.&lt;BR /&gt;
&lt;BR /&gt;
Below is an example of one of the files "MEM122-ALI-FamilySnapShotExtract". The folder contains these files:&lt;BR /&gt;
&lt;BR /&gt;
MEM122-ALI-FamilySnapShotExtract_2009-02-16-07-34-32.txt&lt;BR /&gt;
MEM122-ALI-FamilySnapShotExtract_2009-02-23-05-35-26.txt&lt;BR /&gt;
MEM122-ALI-FamilySnapShotExtract_2009-03-02-05-29-14.txt&lt;BR /&gt;
&lt;BR /&gt;
The latest file is MEM122-ALI-FamilySnapShotExtract_2009-03-02-05-29-14.txt i.e. that was created on 2nd March 2009.&lt;BR /&gt;
&lt;BR /&gt;
I want to be able to set a variable say D121SA to point to this file&lt;BR /&gt;
&lt;BR /&gt;
e.g. &lt;BR /&gt;
&lt;BR /&gt;
%LET 	D121SA	=	MEM122-ALI-FamilySnapShotExtract_2009-03-02-05-29-14.txt ;&lt;BR /&gt;
&lt;BR /&gt;
Any help appreciated!</description>
      <pubDate>Mon, 02 Mar 2009 06:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75985#M16389</guid>
      <dc:creator>Mahesh_K</dc:creator>
      <dc:date>2009-03-02T06:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Help - Parsing the most recent file in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75986#M16390</link>
      <description>Do you know what datepart the timestamp part of the filename you want to read has when you run the code - or is this something you would have to determine as well (i.e. by reading the file with the most current date)?</description>
      <pubDate>Mon, 02 Mar 2009 08:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75986#M16390</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-03-02T08:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Help - Parsing the most recent file in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75987#M16391</link>
      <description>Something like this might be a start:&lt;BR /&gt;
&lt;BR /&gt;
filename test pipe 'dir /OD';&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
 infile test;&lt;BR /&gt;
 length a $2000;&lt;BR /&gt;
 input a;&lt;BR /&gt;
 if _n_ = 1 then put a=;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
//Fredrik</description>
      <pubDate>Mon, 02 Mar 2009 13:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75987#M16391</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2009-03-02T13:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Help - Parsing the most recent file in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75988#M16392</link>
      <description>The timestamp is included in the file name&lt;BR /&gt;
&lt;BR /&gt;
e.g. _2009-02-16-07-34-32.txt&lt;BR /&gt;
&lt;BR /&gt;
Alternatively, it could also be the latest file in the directory.</description>
      <pubDate>Mon, 02 Mar 2009 22:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75988#M16392</guid>
      <dc:creator>Mahesh_K</dc:creator>
      <dc:date>2009-03-02T22:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automation Help - Parsing the most recent file in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75990#M16394</link>
      <description>Thanks Proccontents.&lt;BR /&gt;
I was just going to write an answer before I read your post.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://groups.google.com.au/group/comp.soft-sys.sas/browse_thread/thread/382ea2336c72e44/190b2aef220ffffa?hl=en&amp;amp;lnk=gst&amp;amp;q=mahesh#190b2aef220ffffa" target="_blank"&gt;http://groups.google.com.au/group/comp.soft-sys.sas/browse_thread/thread/382ea2336c72e44/190b2aef220ffffa?hl=en&amp;amp;lnk=gst&amp;amp;q=mahesh#190b2aef220ffffa&lt;/A&gt;</description>
      <pubDate>Tue, 03 Mar 2009 07:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automation-Help-Parsing-the-most-recent-file-in-a-folder/m-p/75990#M16394</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-03-03T07:06:51Z</dc:date>
    </item>
  </channel>
</rss>

