Previous Page | Next Page

The DATASETS Procedure

PROC DATASETS Statement


PROC DATASETS <option-1 <...option-n>>;

Task Option
Provide alter access to any alter-protected SAS file in the SAS library ALTER=
Include information in the log about the number of observations, number of variables, number of indexes, and data set labels DETAILS|NODETAILS
Force a RUN group to execute even when there are errors FORCE
Force an append operation FORCE
Restrict processing for generation data sets GENNUM=
Delete SAS files KILL
Specify the procedure input/output library LIBRARY=
Restrict processing to a certain type of SAS file MEMTYPE=
Suppress the printing of the directory NOLIST
Suppress error processing NOWARN
Provide read, write, or alter access PW=
Provide read access READ=


Options

ALTER=alter-password

provides the alter password for any alter-protected SAS files in the SAS library.

See also: Using Passwords with the DATASETS Procedure
DETAILS|NODETAILS

determines whether the following columns are written to the log:

Obs, Entries, or Indexes

gives the number of observations for SAS files of type AUDIT, DATA, and VIEW; the number of entries for type CATALOG; and the number of files of type INDEX that are associated with a data file, if any. If SAS cannot determine the number of observations in a SAS data set, the value in this column is set to missing. For example, in a very large data set, if the number of observations or deleted observations exceeds the number that can be stored in a double-precision integer, the count shows as missing. The value for type CATALOG is the total number of entries. For other types, this column is blank.

Tip: The value for files of type INDEX includes both user-defined indexes and indexes created by integrity constraints. To view index ownership and attribute information, use PROC DATASETS with the CONTENTS statement and the OUT2 option.
Vars

gives the number of variables for types AUDIT, DATA, and VIEW. If SAS cannot determine the number of variables in the SAS data set, the value in this column is set to missing. For other types, this column is blank.

Label

contains the label associated with the SAS data set. This column prints a label only for the type DATA.

The DETAILS option affects output only when a directory is specified and requires read access to all read-protected SAS files in the SAS library. If you do not supply the read password, the directory listing contains missing values for the columns produced by the DETAILS option.

Default: If neither DETAILS or NODETAILS is specified, the default is the system option setting. The default system option setting is NODETAILS.
Tip: If you are using the SAS windowing environment and specify the DETAILS option for a library that contains read-protected SAS files, a dialog box prompts you for each read password that you do not specify in the PROC DATASETS statement. Therefore, you might want to assign the same read password to all SAS files in the same SAS library.
Featured in: Manipulating SAS Files
FORCE

performs two separate actions:

  • forces a RUN group to execute even if errors are present in one or more statements in the RUN group. See RUN-Group Processing for a discussion of RUN-group processing and error handling.

  • forces all APPEND statements to concatenate two data sets even when the variables in the data sets are not exactly the same. The APPEND statement drops the extra variables and issues a warning message to the SAS log unless the NOWARN option is specified (either with the APPEND statement or PROC DATASETS). Refer to APPEND Statement for more information on the FORCE option.

GENNUM=ALL|HIST|REVERT|integer

restricts processing for generation data sets. Valid values are as follows:

ALL

for subordinate CHANGE and DELETE statements, refers to the base version and all historical versions in a generation group.

HIST

for a subordinate DELETE statement, refers to all historical versions, but excludes the base version in a generation group.

REVERT|0

for a subordinate DELETE statement, refers to the base version in a generation group and changes the most current historical version, if it exists, to the base version.

integer

for subordinate AUDIT, CHANGE, MODIFY, DELETE, and REPAIR statements, refers to a specific version in a generation group. Specifying a positive number is an absolute reference to a specific generation number that is appended to a data set name; that is, gennum=2 specifies MYDATA#002. Specifying a negative number is a relative reference to a historical version in relation to the base version, from the youngest to the oldest; that is, gennum=-1 refers to the youngest historical version.

See also:

Restricting Processing for Generation Data Sets

"Understanding Generation Data Sets" in SAS Language Reference: Concepts

KILL

deletes all SAS files in the SAS library that are available for processing. The MEMTYPE= option subsets the member types that the statement deletes. The following example deletes all the data files in the WORK library:

proc datasets lib=work kill memtype=data;
run;
quit;
CAUTION:
The KILL option deletes the SAS files immediately after you submit the statement.   [cautionend]
LIBRARY=libref

names the library that the procedure processes. This library is the procedure input/output library.

Aliases: DDNAME=, DD=, LIB=
Default: WORK or USER. See Temporary and Permanent SAS Data Sets for more information on the WORK and USER libraries.
Restriction: A SAS library that is accessed via a sequential engine (such as a tape format engine) cannot be specified as the value of the LIBRARY= option.
Featured in: Manipulating SAS Files
MEMTYPE=(mtype(s))

restricts processing to one or more member types and restricts the listing of the data library directory to SAS files of the specified member types. For example, the following PROC DATASETS statement limits processing to SAS data sets in the default data library and limits the directory listing in the SAS log to SAS files of member type DATA:

proc datasets memtype=data;
Aliases: MTYPE=, MT=
Default: ALL
See also: Restricting Member Types for Processing
NODETAILS

See the description of DETAILS.

NOLIST

suppresses the printing of the directory of the SAS files in the SAS log.

Featured in: Modifying SAS Data Sets

Note:   If you specify the ODS RTF destination, PROC DATASETS output goes to both the SAS log and the ODS output area. The NOLIST option suppresses output to both. To see the output only in the SAS log, use the ODS EXCLUDE statement by specifying the member directory as the exclusion.  [cautionend]

NOWARN

suppresses the error processing that occurs when a SAS file that is specified in a SAVE, CHANGE, EXCHANGE, REPAIR, DELETE, or COPY statement or listed as the first SAS file in an AGE statement, is not in the procedure input library. When an error occurs and the NOWARN option is in effect, PROC DATASETS continues processing that RUN group. If NOWARN is not in effect, PROC DATASETS stops processing that RUN group and issues a warning for all operations except DELETE, for which it does not stop processing.

PW= password

provides the password for any protected SAS files in the SAS library. PW= can act as an alias for READ=, WRITE=, or ALTER=.

See also: Using Passwords with the DATASETS Procedure
READ=read-password

provides the read-password for any read-protected SAS files in the SAS library.

See also: Using Passwords with the DATASETS Procedure

Previous Page | Next Page | Top of Page