Hello
Let's say that there are multiple txt files with different dates.
For example:
A181127.TXT
A181128.TXT
A181129.TXT
A181130.TXT
The task is to tell SAS to import one file only that will be the file with last date.
How can I do it please?
One option is to find the last file by its file name which has date.
Other option is to find the last file by the date it was created (Import the file that was created last)
Joe
You could use the %DIRLISTWIN macro to read the file names and file dates.
http://support.sas.com/kb/24/820.html
This macro has a few limitations such as requiring pipe access, expecting an English language OS, and expecting AM PM times rather than a 24 hour clock.
If that's not your setup, a much more usable (but less feature-rich) macro is provided here by @BrunoMueller. Still for Windows only though.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.