Help using Base SAS procedures

How to get a list of the names of all SAS data files in my folder?

Accepted Solution Solved
Reply
Super Contributor
Posts: 338
Accepted Solution

How to get a list of the names of all SAS data files in my folder?

Hi SAS Forum,

I wanted to get a list of the names of all SAS data files (no need variable list or file zise) in one of my folders. I have several hundred files there. Need to get a printout of the file names only

I did the following.

1.    1) I defined the libname.

libname abcd……………………;

2.    2) Gave this command

proc print data  =  sashelp.vtable (where = (libname="abcd")) noobs;

  var memname nobs nvar;

run;

Q: It is taking ages. Is there any other alternative?

Thanks

Miris


Accepted Solutions
Solution
‎02-26-2014 02:15 PM
Valued Guide
Posts: 2,175

Re: How to get a list of the names of all SAS data files in my folder?

LIBNAME URLIB "PATH TO YOUR FOLDER" ACCESS= READONLY ;

PROC DATASETS LIBRARY= URLIB ;

RUN;

QUIT;

This will list all SAS file types along with their sizes. Should a table have indexes the filesize for the indexes will also appear.

View solution in original post


All Replies
Regular Contributor
Posts: 180

Re: How to get a list of the names of all SAS data files in my folder?

1. Define the LIBNAME

2. Use PROC CONTENTS.

Super User
Posts: 17,837

Re: How to get a list of the names of all SAS data files in my folder?

If you take a quick look at the SASHELP.VTABLE you'll notice that all library names are stored as upper case, so I'd assume your query wouldn't return anything.

ods table Members=List_files;

proc datasets library=mis ;

run;quit;

Super User
Posts: 5,083

Re: How to get a list of the names of all SAS data files in my folder?

If I'm not wrong ...

The "v" in "vtable" means "view".  So every time you use it, it has to re-create the list of all data set information.  You might find it faster to use PROC SQL and to extract comparable information from DICTIONARY.TABLES.

Good luck.

Solution
‎02-26-2014 02:15 PM
Valued Guide
Posts: 2,175

Re: How to get a list of the names of all SAS data files in my folder?

LIBNAME URLIB "PATH TO YOUR FOLDER" ACCESS= READONLY ;

PROC DATASETS LIBRARY= URLIB ;

RUN;

QUIT;

This will list all SAS file types along with their sizes. Should a table have indexes the filesize for the indexes will also appear.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 220 views
  • 3 likes
  • 5 in conversation