<?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: Way to pick the latest file in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67246#M6744</link>
    <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
You don't need to become a SAS admin - but your SAS admin would have to change NOXCMD to XCMD.&lt;BR /&gt;
&lt;BR /&gt;
NOXCMD is a security feature. So there shouldn't be a way around it.&lt;BR /&gt;
&lt;BR /&gt;
If you know the possible filenames then you could issue filename statements and then query the dictionary table. This would give you the information you're after.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
filename tst1 'c:\temp\test.txt';&lt;BR /&gt;
filename tst2 'c:\temp\test2.txt';&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select *&lt;BR /&gt;
  from sashelp.vextfl&lt;BR /&gt;
  where fileref like 'TST%';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
    <pubDate>Thu, 19 May 2011 23:40:33 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2011-05-19T23:40:33Z</dc:date>
    <item>
      <title>Way to pick the latest file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67243#M6741</link>
      <description>Hi Everyone&lt;BR /&gt;
&lt;BR /&gt;
I am using SAS Enterprise Guide in windows XP environment.&lt;BR /&gt;
&lt;BR /&gt;
As part of my automation work, I need to pick the latest .txt file from a list of different files in a folder and then do some operations on that.&lt;BR /&gt;
&lt;BR /&gt;
Is there any way in SAS which I can use to do this?&lt;BR /&gt;
&lt;BR /&gt;
Request your help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Shankar</description>
      <pubDate>Thu, 19 May 2011 13:48:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67243#M6741</guid>
      <dc:creator>shankar_kumar</dc:creator>
      <dc:date>2011-05-19T13:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Way to pick the latest file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67244#M6742</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
You basically have to issue a command to the OS to get the information you need (i.e. creation date). So first thing you're doing is to open a command window (for Windows or UNIX - whatever your server environment is ) and get the command right. You then use either "filename ... pipe" or an "X" command from within SAS to send the "OS" command and retrieve the result for further processing. There are several examples in the SAS doc and in SAS notes of how to do this.&lt;BR /&gt;
&lt;BR /&gt;
The one thing you should check first is if you're allowed to issue OS command from an EG session. Execute "Proc Options; run;" and then look in the log for "XCMD". If the value is "NOXCMD" (that's the installation default) then you've got a problem because EG won't allow you to issue OS commands. You then would have to talk to your SAS admin first.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Thu, 19 May 2011 14:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67244#M6742</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-05-19T14:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Way to pick the latest file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67245#M6743</link>
      <description>Hi Patrick&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your reply.&lt;BR /&gt;
&lt;BR /&gt;
However, as said I am not allowed to use any OS specific commands as they are disabled.&lt;BR /&gt;
&lt;BR /&gt;
Any other way which I can use to do it apart from requesting SAS admin?&lt;BR /&gt;
&lt;BR /&gt;
Please suggest.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Shankar</description>
      <pubDate>Thu, 19 May 2011 17:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67245#M6743</guid>
      <dc:creator>shankar_kumar</dc:creator>
      <dc:date>2011-05-19T17:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Way to pick the latest file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67246#M6744</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
You don't need to become a SAS admin - but your SAS admin would have to change NOXCMD to XCMD.&lt;BR /&gt;
&lt;BR /&gt;
NOXCMD is a security feature. So there shouldn't be a way around it.&lt;BR /&gt;
&lt;BR /&gt;
If you know the possible filenames then you could issue filename statements and then query the dictionary table. This would give you the information you're after.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
filename tst1 'c:\temp\test.txt';&lt;BR /&gt;
filename tst2 'c:\temp\test2.txt';&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select *&lt;BR /&gt;
  from sashelp.vextfl&lt;BR /&gt;
  where fileref like 'TST%';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Thu, 19 May 2011 23:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67246#M6744</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-05-19T23:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Way to pick the latest file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67247#M6745</link>
      <description>Hi, Shankar&lt;BR /&gt;
&lt;BR /&gt;
Here's a (slightly modified) piece of code that I use in EG on XP. It uses the SAS "External Files" functions to find the files in a directory. I only need the filename, but there's an "FINFO" function that you can probably use to get date information.&lt;BR /&gt;
&lt;BR /&gt;
Tom&lt;BR /&gt;
&lt;BR /&gt;
data work.dsns(keep=infref);&lt;BR /&gt;
     length infref $ 64;&lt;BR /&gt;
     rc=filename("htmldir","c:\Source");&lt;BR /&gt;
     htmld=dopen("htmldir");&lt;BR /&gt;
     dsncount=dnum(htmld);&lt;BR /&gt;
     do i = 1 to dsncount;&lt;BR /&gt;
       infref = dread(htmld,i);&lt;BR /&gt;
     end;&lt;BR /&gt;
     rc=dclose(htmld);&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 23 May 2011 15:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Way-to-pick-the-latest-file/m-p/67247#M6745</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2011-05-23T15:14:56Z</dc:date>
    </item>
  </channel>
</rss>

