Listing member types and attributes

Reply
Occasional Contributor
Posts: 8

Listing member types and attributes

How to list all member types in a directory and the corresponding attributes and save in a sas data set ?

Super User
Super User
Posts: 7,720

Re: Listing member types and attributes

Have a look at SASHELP.VCOLUMN, this holds all the variables of each dataset in all libraries.  There is also SASHELP.VTABLE which holds the dataset information.  These are the same as DICTIONARY.* in SQL.

Occasional Contributor
Posts: 8

Re: Listing member types and attributes

Hi,

Thanks for the useful information, but i am seeking the members of system directory not only SAS.

In other words if i have a list of excel files or word documents etc... how to capture all those files in a sas dataset with the DOS attributes (name,date modified,type,size etc....)

Thanks again.

Super User
Posts: 7,444

Re: Listing member types and attributes

Either use the x statement or call system routine to execute dir directory > somefile.lst, and then read from somefile.lst, or use

filename oscmd pipe "dir directory";

data listing;

infile oscmd truncover;

input dirline $1024.;

run;

Be aware that all this may not work when SAS operates under the -noxcmd commandline option.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 8

Re: Listing member types and attributes

Thanks for this approach.

After running the above code, a listing of the different members were collected as line records.

Hence a search is required to determine the required factor.

Got it.

Super User
Super User
Posts: 7,720

Re: Listing member types and attributes

What is it your trying to get, give specific examples?  There are many options that you can put on the directory command, in your command prompt window, type dir /? and you will see them.  Yes, if you want lots of information then you will need to parse the incoming string, it is not however particularly difficult, substr(1,first blank gives filename, then drop that, then to next blank gives size etc.

Super User
Posts: 11,134

Re: Listing member types and attributes

You can can use the External files functions to determine this. DOPEN,DOPTNUM,DOPTNAME , FOPEN, FOPTNAME, FOPTNUM to get directory and file information.

Ask a Question
Discussion stats
  • 6 replies
  • 237 views
  • 6 likes
  • 4 in conversation