BookmarkSubscribeRSS Feed
Valesca_1012
Calcite | Level 5

I have 3 .txt files and need create a SAS dataset with :
- a variable with datetime of the creating this files
- a variable with filename
- a variable with filesize
How can I do this ?

 

Example :

I have 3 files called : claims.txt, sales.txt and product.txt

I need a SAS dataset called CONTROL like this :

Name

Size

Datetime

Claims

446.335

10/19/2017 15:34:00

Sales

357.051

10/19/2017 15:34:00

Products

9.909.169

10/19/2017 15:34:00

Claims

447.698

10/20/2017 16:00:01

Sales

357.063

10/20/2017 16:00:01

 

This informations are about when the files were created and copied in the folder

3 REPLIES 3
TomKari
Onyx | Level 15

Look in the Base SAS Functions help information, the category of "External Files". SAS has functions that will let you retrieve all of this information, with examples in the help text.

 

Tom

ChrisHemedinger
Community Manager

There's a good example of using FINFO to retrieve these attributes -- it's in this SAS Note.

SAS Innovate 2025: Call for Content! Submit your proposals before Sept 16. Accepted presenters get amazing perks to attend the conference!
Reeza
Super User

And another option, which is the same as the suggestion yesterday, but here's an example. 

 

https://communities.sas.com/t5/SAS-Enterprise-Guide/QA-Data-Set/m-p/404961

 

data meta;
    /*Source table mentioned already*/
    set sashelp.vtable;

    /*this limits the data sets in the list, you can remove it*/
    where memname in ('AIR', 'CARS', 'SHOES', 'BASEBALL', 'CLASS', 'FISH');

    /*variables your interested in keeping:
    data set name, created date, modificaiton date and filesize*/
    KEEP MEMNAME CRDATE MODDATE FILESIZE;
RUN;

*Display results;

Proc print data=meta;
run;a

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 790 views
  • 0 likes
  • 4 in conversation