BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bubblui
Calcite | Level 5

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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;

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Are the files all located in the same directory? 🙂

bubblui
Calcite | Level 5

yes they are in same folder.

BrunoMueller
SAS Super FREQ

Hi

 

Have a look here http://support.sas.com/kb/40/934.html

 

Bruno

 

BrunoMueller
SAS Super FREQ

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;
bubblui
Calcite | Level 5

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 

bubblui
Calcite | Level 5
Hi Bruno_sas,

Thank you.

I too used the same program, I think i was out of the world by not seeing the path.

When the path was corrected it worked fine.

Thanks a lot.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 6469 views
  • 2 likes
  • 3 in conversation