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 displays information about the data sets (member type DATA) that
are stored in USCLIM:
Figure 37.2 Directory of Data Sets Only for the Library USCLIM
Note: Examples in this document 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.
Requesting Contents Information about SAS Data
Using the DATASETS Procedure for SAS Data Sets
To look at the contents of a SAS data set without displaying the observations, use the
CONTENTS statement in the DATASETS procedure. The CONTENTS statement and
its options provide descriptive information about data sets and a list of variables and
their attributes.
704 Chapter 37 Getting Information about Your SAS Data Sets
Listing the Contents of One Data Set
The SAS library USCLIM contains four data sets. The data set TEMPCHNG contains
data for extreme changes in temperature. The following program displays the variables
in the data set TEMPCHNG:
proc datasets library=usclim memtype=data;
contents data=tempchng;
The output from the CONTENTS statement produces information about the
TEMPCHNG data set. The DATA= option specifies the name of the data set. The
following output shows the results from the CONTENTS statement.
Figure 37.3 Output from CONTENTS Statement for Data Set TEMPCHNG
Requesting Contents Information about SAS Data Sets 705
Note that output from the CONTENTS statement varies for different operating
The following list describes information that you might find when you use the
The DATASETS Procedure heading
contains field names. Fields are empty if they do not apply to the data set. Field
names are listed below:
Data Set Name
specifies the two-level name that is assigned to the data set.
Member Type
specifies the type of library member.
specifies the access method that SAS uses to read from or write to the data set.
specifies the date on which the data set was created.
Last Modified
specifies the last date that the data set was modified.
indicates whether the data set is password protected for READ, WRITE, or
ALTER operations.
Data Set Type
applies only to files with the member type DATA. Information in this field
indicates that the data set contains special observations and variables for use with
SAS statistical procedures.
specifies the descriptive information that you supply in a LABEL= data set
option to identify the data set.
Data Representation
specifies the form in which data is stored in a particular operating environment.
specifies a mapping of a coded character set to code values. Each character in a
character set maps to a unique numeric representation.
specifies the total number of observations that are currently in the data set.
specifies the number of variables in the data set.
specifies the number of indexes for the data set.
Observation Length
specifies the length of each observation in bytes.
Deleted Observations
specifies the number of observations that are marked for deletion, if applicable.
indicates whether the data has fixed-length or variable-length records. If the data
set is compressed, then additional fields indicate whether new observations are
added to the end of the data set or written to unused space within the data set. It
706 Chapter 37 Getting Information about Your SAS Data Sets

Get Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.