Hello All,
We can get the information about individual files using FINFO() function, but it doesn't work for getting folder information. Can anyone help how we can retrieve directory information (filenames, size, last modified..etc) from SAS and store in to the dataset??
Note - In Unix environement
Thanks!
You can use command line to pipe in the information, using x command or call system.
http://support.sas.com/kb/45/805.html
That's assuming you have the permission. I would question why you need this information though? Filenames you can get through SAS functions, just look up the finfo function documentation and then have a look at the other functions. Dont know what use size or last modified would be though, last modified should not really be trusted for anything.
The size of a directory, as retrieved by the ls command, is the size of the directory file itself, and correlates to the maximum number of directory entries that were ever stored at one time in this file (directory files do not shrink when entries are deleted). It is NOT the size of the contents!
The modification timestamp of a directory is the most recent time when a file was added, deleted, or had its name changed. It is NOT the time when any of the contents changed!
UNIX directories do not hold any metadata about files, these are retrieved from the inode table; only pointers to the inode table and names are stored in UNIX directories, that's why you can have multiple (hard) links (read: multiple names in multiple locations) to a single inode and therefore a single file.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.