Chapter Contents

Previous

Next
The DATASETS Procedure

CONTENTS Statement


Describes the contents of one or more SAS data sets and prints the directory of the SAS data library.

Reminder: You can use data set options with the BASE= and DATA= options. See Statements with the Same Function in Multiple Procedures for details. You can also use any global statements as well. See Global Statements for a list.
Featured in: Describing a SAS Data Set


CONTENTS<option(s)>;

To do this Use this option
Specify the input data set DATA=
Specify the name for an output data set OUT=
Specify the name of an output data set to contain information about indexes and constraints OUT2=
Include information in the output about the number of observations, number of variables, and data set labels DETAILS|NODETAILS
Print a list of the SAS files in the SAS data library DIRECTORY
Print the length of a variable's informat or format FMTLEN
Restrict processing to one or more types of SAS files MEMTYPE=
Suppress the printing of individual files NODS
Suppress the printing of the output NOPRINT
Print a list of the variables by their position in the data set VARNUM
Print abbreviated output SHORT
Print centiles information for indexed variables CENTILES


Options

CENTILES
prints centiles information for indexed variables.

DATA=SAS-file-specification
specifies an entire library or a specific SAS data set within a library. SAS-file-specification can take one of the following forms:

<libref.>SAS-data-set
names one SAS data set to process. The default for libref is the libref of the procedure input library. For example, to obtain the contents of the SAS data set HTWT from the procedure input library, use the following CONTENTS statement:
contents data=HtWt;
To obtain the contents of a specific generation file, use the following CONTENTS statement:
contents data=HtWt(gennum=3);

<libref.>_ALL_
gives you information about all SAS data sets having the type or types specified by the MEMTYPE= option. libref refers to the SAS data library. The default for libref is the libref of the procedure input library.

  • If you are using the _ALL_ keyword, you need read access to all read-protected SAS data sets in the SAS data library.

  • DATA=_ALL_ automatically prints a listing of SAS files in the library.

Default: most recently created data set in your job or session, from any SAS data library
Tip: If you specify a read-protected data set in the DATA= option but do not give the read password, by default the procedure looks in the PROC DATASETS statement for the read password. However, if you do not specify the DATA= option and the default data set (last one created in the session) is read protected, the procedure does not look in the PROC DATASETS statement for the read password.
Featured in: Describing a SAS Data Set

DETAILS|NODETAILS
includes three additional columns in the directory.
Default: first defaults to DETAILS option in PROC DATASETS statement, then to the DETAILS system option setting.
See also: description of these additional columns in "Options" in PROC DATASETS Statement

DIRECTORY
prints a list of all SAS files in the specified SAS data library.

FMTLEN
prints the length of the informat or format. If you do not specify a length for the informat or format when you associate it with a variable, the length does not appear in the output of the CONTENTS statement unless you use the FMTLEN option. The length also appears in the FORMATL or INFORML variable in the output data set.

MEMTYPE=(mtype(s))
restricts processing to one or more member types. The CONTENTS statement produces output only for member types DATA, VIEW, and ALL, which includes DATA and VIEW.

MEMTYPE= in the CONTENTS statement differs from MEMTYPE= in most of the other statements in the DATASETS procedure in the following ways:

Specifying the MEMTYPE= option in the PROC DATASETS statement affects the CONTENTS statement only if you specify the _ALL_ keyword in the DATA= option. For example, the following statements produce the contents of only the SAS data sets with member type DATA:

proc datasets memtype=data;
   contents data=_all_;
run;
Aliases: MT=, MTYPE=
Default: DATA

NODS
suppresses printing the contents of individual files when you specify _ALL_ in the DATA= option. The CONTENTS statement prints only the SAS data library directory. You cannot use the NODS option when you specify only one SAS data set in the DATA= option.

NODETAILS
See the description of DETAILS .

NOPRINT
suppresses printing the output of the CONTENTS statement.

OUT=SAS-data-set
names an output SAS data set.
Tip: OUT= does not suppress the printed output from the statement. If you want to suppress the printed output, you must use the NOPRINT option.
See also: The OUT= Data Set for a description of the variables in the OUT= data set.

OUT2=SAS-data-set
names an output data set to contain information about indexes and integrity constraints.
See also: The OUT2= Data Set for a description of the variables in the OUT2= data set.

SHORT
prints only the list of variable names, the index information, and the sort information for the SAS data set.

VARNUM
prints a second list of the variable names in the order of their logical position in the data set. By default, the CONTENTS statement lists the variables alphabetically. The physical position of the variable in the data set is engine-dependent.


Using the CONTENTS Procedure Instead of the CONTENTS Statement
The only difference between the CONTENTS procedure and the CONTENTS statement in PROC DATASETS is the default for libref in the DATA= option. For PROC CONTENTS, the default is either WORK or USER. For the CONTENTS statement, the default is the libref of the procedure input library.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.