Getting Information about Your SAS Data Sets |
Understanding a Directory Listing |
A directory listing is a list of files in a SAS data library. Each file is called a member, and each member has a member type that is assigned to it by SAS. The member type indicates the type of SAS file, such as DATA or CATALOG. When SAS processes statements, SAS not only looks for the specified file, it verifies that the file has a member type that can be processed by the statement.
The directory listing contains two parts:
Listing All Files in a Library |
To obtain a directory listing of all members in a library, you need only the PROC DATASETS statement and the LIBRARY= option. For example, the following statements send a directory listing to the SAS log for a library that contains climate information. The LIBNAME statement assigns the libref USCLIM to this library.
options pagesize=60 linesize=80 nonumber nodate; libname usclim 'SAS-data-library'; proc datasets library=usclim;
The following output shows the resulting SAS log, which contains the directory listing:
Directory Listing for the Library USCLIM
22 options pagesize=60 linesize=80 nonumber nodate; 23 libname usclim 'SAS-data-library'; NOTE: Libref USCLIM was successfully assigned as follows: Engine: V8 Physical Name: external-file 24 25 proc datasets library=usclim; -----Directory----- 1 Libref: USCLIM Engine: V8 Physical Name: external-file File Name: external-file Inode Number: 1864992 Access Permission: rwxr-xr-x Owner Name: userid File Size (bytes): 4096 File # Name 2 Memtype 3 Size Last Modified -------------------------------------------------- 1 BASETEMP CATALOG 20480 15NOV2000:14:38:35 2 HIGHTEMP DATA 16384 15NOV2000:14:26:48 3 HURRICANE DATA 16384 15NOV2000:14:29:11 4 LOWTEMP DATA 16384 15NOV2000:14:30:08 5 REPORT CATALOG 20480 15NOV2000:14:39:02 6 TEMPCHNG DATA 16384 15NOV2000:14:30:41
The following list corresponds to the numbered items in the preceding output:
Listing Files That Have the Same Member Type |
To show only certain types of SAS files in the directory listing, use the MEMTYPE= option in the PROC DATASETS statement. The following statement produces a listing for USCLIM that contains only the information about data sets:
proc datasets library=usclim memtype=data;
The following output shows the SAS log, which lists only the data sets that are stored in USCLIM:
Directory Listing of Data Sets Only for the Library USCLIM
7 options pagesize=60 linesize=80 nonumber nodate; 8 libname usclim 'SAS-data-library'; NOTE: Libref USCLIM was successfully assigned as follows: Engine: V8 Physical Name: external-file 9 10 proc datasets library=usclim memtype=data; -----Directory----- Libref: USCLIM Engine: V8 Physical Name: external-file File Name: external-file Inode Number: 1864992 Access Permission: rwxr-xr-x Owner Name: userid File Size (bytes): 4096 File # Name Memtype Size Last Modified -------------------------------------------------- 1 HIGHTEMP DATA 16384 15NOV2000:14:26:48 2 HURRICANE DATA 16384 15NOV2000:14:29:11 3 LOWTEMP DATA 16384 15NOV2000:14:30:08 4 TEMPCHNG DATA 16384 15NOV2000:14:30:41
Note: Examples in this documentation focus on using PROC DATASETS to manage only SAS data sets; you can also list other member types by specifying MEMTYPE=. For example, MEMTYPE=CATALOG lists only SAS catalogs.
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.