Use the file functions fopen, foptnum, foptname and finfo:
filename fref 'D:\testing.xlsx';
data fileinfo;
fid = fopen("fref");
do i = 1 to foptnum(fid);
opt = foptname(fid,i);
val = finfo(fid,opt);
output;
end;
run;
One of the information items will contain what you look for. Be aware that the names and values are specific to the operating system and the system's locale.
data have;
input filename$1024.;
cards;
D:\testing.xlsx
;
data want;
set have;
rcs = filename("fileref", filename);
fid=fopen('fileref');
Bytes=finfo(fid,'File Size (bytes)');
crdate=finfo(fid,'Create Time');
moddate=finfo(fid,'Last Modified');
run;
proc print;
run;
As I said, the optnames are locale- and system-specific. In my case (AIX, German), there is no "Create Time" at all (it is misleading information anyway), but a "Zuletzt geändert" (modification time).
This is why I strongly prefer to use system commands for this, as they can be directed by parameters (see GNU ls) to return specific information in a specific format (like ISO-timestamps), independent of the current environment.
I agree with your points, Thank you for your valuable comment. ![]()
Please post the log. "Does not work" on its own is USELESS.
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 save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.