BookmarkSubscribeRSS Feed
CR-Horton
Fluorite | Level 6

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.

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

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?

CR-Horton
Fluorite | Level 6
Thanks for the response, Chris.

Yes, I was hoping just to add the modified date as another column in the dataset. Also, correct, it's the modified date of the file on the FTP.

I am still looking into what can be done and also considering Kurt's comment.
Kurt_Bremser
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 754 views
  • 0 likes
  • 3 in conversation