Hello,
I am reading in a .txt file from an FTP using the filename statement. I have successfully read in the file, but I am wanting to add a column for the last modified date as it appears on the FTP. I am aware of the FINFO(fid,'Last Modified'); option, but I cannot seem to get it to work.
Is there a way to easily capture the last modified date for the file that I am reading in using the filename statement FTP access method?
The end goal for me is to automate the SAS program to run and pull in the file every time the file is updated on the FTP.
Thanks in advance.
Where does the date go? Where's that new column?
Is it the modified date of the file on the FTP server you want to use?
I doubt it is kept when the file's download, or accessible with the FINFO() function. Can you get a DSID when you OPEN() the file?
The FINFO function is only for files that are physically present in the filespace of the SAS session. To retrieve metadata of remote files, you would need to use external FTP (requiring that OPTIONS XCMD is enabled) to retrieve a file listing from which you can pull the modification timestamp.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.