06-15-2016 09:57 AM
I have 100' of files in my directory of which i need to use the file with the latest date .
For example if i have two files with same names but different dates at the end I should pick up latest file and copy in x location or directory . But if there is only one file like this HPG-XX-YYYY_Pricing C_X_03_19_2012_1.xls . then use this and copy in x location or directory
Can anyone pls help . Can we approach this using a macro or any other sas procedure
06-15-2016 10:07 AM
If you search on here you'll find many examples.
The general steps are get a listing of files from the directory into a dataset. Process as necessary, in your case chose latest. Then copy.
That being said, this is probably better done as a UNIX or powershell script that you can then call from SAS.
So, before we can point you to reference, what's your OS, and can you execute X commands from SAS?
06-15-2016 10:16 AM
I should check because when i run below code in my sas eg
call system ('ls -l');
i am getting below error it means i dont have access ?
ERROR: Shell escape is not valid in this SAS session.