Hi All,
Have a great day...!
I have a column (file_name) with File names as values. Now I need to obtain each file Date and time of Created and modified.
INPUT Dataset
file_name |
File1 |
File2 |
File3 |
File4 |
File5 |
Output Dataset
File_name | Moddate |
File1 | Xx |
File2 | Xx |
File3 | Xx |
File4 | Xx |
File5 | xx |
Please give me some suggestion.
Hi
You can take this code
data have;
length filename $ 1024;
input
filename
;
cards;
c:\temp\anchor.pdf
c:\temp\Book1.csv
;
data a;
set have;
rcs = filename("fileref", filename);
msgs = sysmsg();
fid=fopen('fileref');
Bytes=finfo(fid,'File Size (bytes)');
crdate=finfo(fid,'Create Time');
moddate=finfo(fid,'Last Modified');
rc = fclose(fid);
rcc = filename("fileref");
run;
proc print;
run;
Are the files all located in the same directory? 🙂
yes they are in same folder.
Hi
You can take this code
data have;
length filename $ 1024;
input
filename
;
cards;
c:\temp\anchor.pdf
c:\temp\Book1.csv
;
data a;
set have;
rcs = filename("fileref", filename);
msgs = sysmsg();
fid=fopen('fileref');
Bytes=finfo(fid,'File Size (bytes)');
crdate=finfo(fid,'Create Time');
moddate=finfo(fid,'Last Modified');
rc = fclose(fid);
rcc = filename("fileref");
run;
proc print;
run;
Hi,
Thank you.
I tried doing it. But when I did it I am getting following note:
Note: Arguement 1 to function finfo at line xxx column xx is invalid.
Any idea on what reason this note occurs
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: