Chapter Contents

Previous

Next
The DATASETS Procedure

Results


Directory Listing to the SAS Log
The PROC DATASETS statement lists the SAS files in the procedure input library unless the NOLIST option is specified. If you specify the MEMTYPE= option, only specified types are listed. If you specify the DETAILS option, PROC DATASETS prints three additional columns of information: Obs or Entries, Vars, and Label.


Directory Listing as SAS Output
The CONTENTS statement lists the directory of the procedure input library if you use the DIRECTORY option or use DATA=_ALL_.

If you want only a directory, use the NODS option and the _ALL_ keyword in the DATA= option. The NODS option suppresses the description of the SAS data sets; only the directory appears in the output.

Note:    The CONTENTS statement does not put a directory in an output data set. If you try to create an output data set using the NODS option, you receive an empty output data set. Use the SQL procedure to create a SAS data set that contains information about a SAS data library. See DICTIONARY tables for more information.  [cautionend]


Procedure Output
The only statement in PROC DATASETS that produces procedure output is the CONTENTS statement. This section shows the output from the CONTENTS statement for the GROUP data set, including the modifications made to the GROUP data set in Modifying SAS Data Sets .

Only the items in the output that require explanation are discussed.

Data Set Attributes

Here are descriptions of selected fields in Data Set Attributes Section :
Member Type
names the type of library member (DATA or VIEW).

Protection
indicates whether the SAS data set is READ, WRITE, or ALTER protected.

Data Set Type
names the special data set type (such as CORR, COV, SSPC, EST, or FACTOR), if any.

Deleted Observations
is the number of observations marked for deletion. These observations are not included in the total number of observations, shown in the Observations field.

Compressed
indicates whether the data set is compressed. If the data set is compressed, the output includes an additional item, Reuse Space (with a value of YES or NO), that indicates whether to reuse space that is made available when observations are deleted.

Sorted
indicates whether the data set is sorted. If you sort the data set with PROC SORT, PROC SQL, or specify sort information with the SORTEDBY= data set option, a value of YES appears here, and there is an additional section to the output. See Sort Information for details.

Data Set Attributes Section
                           The Contents of the GROUP Data Set                                            

                                     DATASETS PROCEDURE

     Data Set Name: HEALTH.GROUP                            Observations:         148
     Member Type:   DATA                                    Variables:            11 
     Engine:        V7                                      Indexes:              1  
     Created:       10:42 Thursday, August 28, 1997         Observation Length:   96 
     Last Modified: 11:13 Thursday, August 28, 1997         Deleted Observations: 0  
     Protection:    READ                                    Compressed:           NO 
     Data Set Type:                                         Sorted:               YES
     Label:         Test Subjects                    
                                

  


Engine and Operating Environment-dependent Information

The CONTENTS statement produces operating environment-specific and engine-specific information. This information differs depending on the operating environment. The example in Engine and Operating Environment Dependent Information Section of CONTENTS Output is from the UNIX environment.

Engine and Operating Environment Dependent Information Section of CONTENTS Output
               -----Engine/Host Dependent Information-----

                   Data Set Page Size:         8192                      
                                       
                   Number of Data Set Pages:   4                         
                                       
                   File Format:                7                         
                                       
                   First Data Page:            1                         
                                       
                   Max Obs per Page:           84                        
                                       
                   Obs in First Data Page:     62                        
                                       
                   Index File Page Size:       4096                      
                                       
                   Number of Index File Pages: 2                         
                                       
                   Number of Data Set Repairs: 0                         
                                       
                   File Name:                  external-file
                   Release Created:            7.00.000                  
                                       
                   Host Created:               HP-UX                     
                                       
                   Inode Number:               718939608                 
                                       
                   Access Permission:          rw-r--r--                 
                                       
                   Owner Name:                 UNIX-userid  
                                                         
                   File Size (bytes):          40960                     
                                       


Alphabetic List of Variables and Attributes

Here are descriptions of selected columns in Variable Attributes Section :
#
indicates the position of each variable in the data set.

Variable
is the name of each variable. By default, variables appear alphabetically.

Note:   Variable names are sorted such that X1, X2, and X10 appear in that order and not in the true collating sequence of X1, X10, and X2. Variable names that contain an underscore and digits may appear in a nonstandard sort order. For example, P25 and P75 appear before P2_5.  [cautionend]

Type
specifies the type of variable, character or numeric.

Pos
specifies the starting position of each variable in the observation.

Note:   If none of the variables in the SAS data set has a format, informat, or label associated with it, the column for that attribute does not appear.   [cautionend]

Variable Attributes Section
-----Alphabetic List of Variables and Attributes-----
 
                    
#    Variable    Type    Len    Pos    Format     Informat     Label
----------------------------------------------------------------------------------------
 9    BIRTH       Num       8      8    DATE7.     DATE7.
                                   
 4    CITY        Char     15     58    $.         $. 
                                      
 3    FNAME       Char     15     43    $.         $. 
                                       
10    HIRED       Num       8     16    DATE7.     DATE7.
  
11    HPHONE      Char     12     79    $.         $. 
                                      
 1    IDNUM       Char      4     24    $.         $. 
                                      
 7    JOBCODE     Char      3     76    $.         $. 
                                      
 2    LNAME       Char     15     28    $.         $. 
                                      
 8    SALARY      Num       8      0    COMMA8.                current salary excluding bonus

 6    SEX         Char      1     75    $.         $. 
                                      
 5    STATE       Char      2     73    $.         $. 
                                      

   


Alphabetic List of Indexes and Attributes

The section shown in Index Attributes Section appears only if the data set has indexes associated with it.
#
indicates the number of each index. The CONTENTS statement numbers the indexes sequentially as they are defined.

Index
displays the name of each index. For simple indexes, the name of the index is the same as a variable in the data set.

Unique Option
indicates whether the index must have unique values. If the column contains YES, the combination of values of the index variables is unique for each observation.

Nomiss Option
indicates whether the index excludes missing values for all index variables. If the column contains YES, the index does not contain observations with missing values for all index variables.

# of Unique Values
gives the number of unique values in the index.

Variables
names the variables in a composite index.

Index Attributes Section
     -----Alphabetic List of Indexes and Attributes-----
 
                                                                         
                                          # of
                    Unique    Nomiss    Unique
      #    Index    Option    Option    Values   Variables
      --------------------------------------------------------
      1    vital    YES       YES          148    BIRTH SALARY


Sort Information

The section shown in Sort Information Section appears only if the Sorted field has a value of YES.
Sortedby
indicates how the data are currently sorted. This field contains either the variables and options you use in the BY statement in PROC SORT, the column name in PROC SQL, or the values you specify in the SORTEDBY= option.

Validated
indicates whether PROC SORT or PROC SQL sorted the data. If PROC SORT or PROC SQL sorted the data set, the value is YES. If you assigned the sort information with the SORTEDBY= data set option, the value is NO.

Character Set
is the character set used to sort the data. The value for this field can be ASCII, EBCDIC, or PASCII.

Collating Sequence
is the collating sequence used to sort the data set. This field does not appear if you do not specify a specific collating sequence that is different from the character set. (not shown)

Sort Option
indicates whether PROC SORT used the NODUPKEY or NODUPREC option when sorting the data set. This field does not appear if you did not use one of these options in a PROC SORT statement. (not shown)

Sort Information Section
                        -----Sort Information-----

                           Sortedby:      LNAME
                           Validated:     NO
                           Character Set: ASCII


Output Data Sets
The CONTENTS statement is the only statement in the DATASETS procedure that generates output data sets.

The OUT= Data Set

The OUT= option in the CONTENTS statement creates an output data set. Each variable in each DATA= data set has one observation in the OUT= data set. These are the variables in the output data set:
CHARSET
the character set used to sort the data set. The value is ASCII, EBCDIC, or PASCII. A blank appears if the data set does not have sort information stored with it.

COLLATE
the collating sequence used to sort the data set. A blank appears if the sort information for the input data set does not include a collating sequence.

COMPRESS
indicates whether the data set is compressed.

CRDATE
date the data set was created.

DELOBS
number of observations marked for deletion in the data set. (Observations can be marked for deletion but not actually deleted when you use the FSEDIT procedure of SAS/FSP software.)

ENCRYPT
indicates whether the data set is encrypted.

ENGINE
name of the method used to read from and write to the data set.

FORMAT
variable format. The value of FORMAT is a blank if you do not associate a format with the variable.

FORMATD
number of decimals you specify when you associate the format with the variable. The value of FORMATD is 0 if you do not specify decimals in the format.

FORMATL
format length. If you specify a length for the format when you associate the format with a variable, the length you specify is the value of FORMATL. If you do not specify a length for the format when you associate the format with a variable, the value of FORMATL is the default length of the format if you use the FMTLEN option and 0 if you do not use the FMTLEN option.

GENMAX
maximum number of files (generations) for the generation group.

GENNEXT
the next generation number for a generation group.

GENNUM
the generation number.

IDXCOUNT
number of indexes for the data set.

IDXUSAGE
use of the variable in indexes. Possible values are

NONE
the variable is not part of an index.

SIMPLE
the variable has a simple index. No other variables are included in the index.

COMPOSITE
the variable is part of a composite index.

BOTH
the variable has a simple index and is part of a composite index.

INFORMAT
variable informat. The value is a blank if you do not associate an informat with the variable.

INFORMD
number of decimals you specify when you associate the informat with the variable. The value is 0 if you do not specify decimals when you associate the informat with the variable.

INFORML
informat length. If you specify a length for the informat when you associate the informat with a variable, the length you specify is the value of INFORML. If you do not specify a length for the informat when you associate the informat with a variable, the value of INFORML is the default length of the informat if you use the FMTLEN option and 0 if you do not use the FMTLEN option.

JUST
justification (0=left, 1=right).

LABEL
variable label (blank if none given).

LENGTH
variable length.

LIBNAME
libref used for the data library.

MEMLABEL
label for this SAS data set (blank if no label).

MEMNAME
SAS data set that contains the variable.

MEMTYPE
library member type (DATA or VIEW).

MODATE
date the data set was last modified.

NAME
variable name.

NOBS
number of observations in the data set.

NODUPKEY
indicates whether the NODUPKEY option was used in a PROC SORT statement to sort the input data set.

NODUPREC
indicates whether the NODUPREC option was used in a PROC SORT statement to sort the input data set.

NPOS
physical position of the first character of the variable in the data set.

POINTOBS
indicates if the data set can be addressed by observation.

PROTECT
the first letter of the level of protection. The value for PROTECT is one or more of the following:
A indicates the data set is alter-protected.
R indicates the data set is read-protected.
W indicates the data set is write-protected.

REUSE
indicates whether the space made available when observations are deleted from a compressed data set should be reused. If the data set is not compressed, the REUSE variable has a value of NO.

SORTED
the value depends on the sorting characteristics of the input data set. Possible values are
. (period) for not sorted.
0 for sorted but not validated.
1 for sorted and validated.

SORTEDBY
the value depends on that variable's role in the sort. Possible values are

. (period)
if the variable was not used to sort the input data set.

n
where n is an integer that denotes the position of that variable in the sort. A negative value of n indicates that the data set is sorted by the descending order of that variable.

TYPE
type of the variable (1=numeric, 2=character).

TYPEMEM
special data set type (blank if no TYPE= value is specified).

VARNUM
variable number in the data set. Variables are numbered in the order they appear.

The output data set is sorted by the variables LIBNAME and MEMNAME.

Note:   The variable names are sorted so that the values X1, X2, and X10 are listed in that order, not in the true collating sequence of X1, X10, X2. Therefore, if you want to use a BY statement on MEMNAME in subsequent steps, run a PROC SORT step on the output data set first or use the NOTSORTED option in the BY statement.  [cautionend]
The Data Set Health.Grpout is an example of an output data set created from the GROUP data set, which is shown in Describing a SAS Data Set and in Procedure Output .

The Data Set Health.Grpout
                        An Example of an Output Data Set                       1

OBS LIBNAME  MEMNAME    MEMLABEL     TYPEMEM  NAME     TYPE  LENGTH  VARNUM

  1 HEALTH    GROUP   Test Subjects           BIRTH      1      8       9  
  2 HEALTH    GROUP   Test Subjects           CITY       2     15       4  
  3 HEALTH    GROUP   Test Subjects           FNAME      2     15       3  
  4 HEALTH    GROUP   Test Subjects           HIRED      1      8      10  
  5 HEALTH    GROUP   Test Subjects           HPHONE     2     12      11  
  6 HEALTH    GROUP   Test Subjects           IDNUM      2      4       1  
  7 HEALTH    GROUP   Test Subjects           JOBCODE    2      3       7  
  8 HEALTH    GROUP   Test Subjects           LNAME      2     15       2  
  9 HEALTH    GROUP   Test Subjects           SALARY     1      8       8  
 10 HEALTH    GROUP   Test Subjects           SEX        2      1       6  
 11 HEALTH    GROUP   Test Subjects           STATE      2      2       5  

OBS             LABEL               FORMAT  FORMATL  FORMATD  INFORMAT  INFORML

  1                                 DATE       7        0       DATE       7   
  2                                 $          0        0       $          0   
  3                                 $          0        0       $          0   
  4                                 DATE       7        0       DATE       7   
  5                                 $          0        0       $          0   
  6                                 $          0        0       $          0   
  7                                 $          0        0       $          0   
  8                                 $          0        0       $          0   
  9 current salary excluding bonus  COMMA      8        0                  0   
 10                                 $          0        0       $          0   
 11                                 $          0        0       $          0   
                        An Example of an Output Data Set                       2

OBS INFORMD JUST NPOS NOBS ENGINE           CRDATE           MODATE DELOBS

  1    0      0    8   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  2    0      0   58   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  3    0      0   43   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  4    0      0   16   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  5    0      0   79   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  6    0      0   24   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  7    0      0   76   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  8    0      0   28   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
  9    0      0    0   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
 10    0      0   75   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  
 11    0      0   73   148   V7   28AUG97:10:42:26 28AUG97:11:13:46    0  

OBS IDXUSAGE  MEMTYPE IDXCOUNT PROTECT FLAGS COMPRESS REUSE SORTED SORTEDBY

  1 COMPOSITE  DATA       1      R--    ---     NO     NO      0       .   
  2 NONE       DATA       1      R--    ---     NO     NO      0       .   
  3 NONE       DATA       1      R--    ---     NO     NO      0       .   
  4 NONE       DATA       1      R--    ---     NO     NO      0       .   
  5 NONE       DATA       1      R--    ---     NO     NO      0       .   
  6 NONE       DATA       1      R--    ---     NO     NO      0       .   
  7 NONE       DATA       1      R--    ---     NO     NO      0       .   
  8 NONE       DATA       1      R--    ---     NO     NO      0       1   
  9 COMPOSITE  DATA       1      R--    ---     NO     NO      0       .   
 10 NONE       DATA       1      R--    ---     NO     NO      0       .   
 11 NONE       DATA       1      R--    ---     NO     NO      0       .   
                        An Example of an Output Data Set                       3

OBS CHARSET COLLATE NODUPKEY NODUPREC ENCRYPT POINTOBS GENMAX GENNUM GENNEXT

  1  ASCII             NO       NO      NO      YES       0      .      0   
  2  ASCII             NO       NO      NO      YES       0      .      0   
  3  ASCII             NO       NO      NO      YES       0      .      0   
  4  ASCII             NO       NO      NO      YES       0      .      0   
  5  ASCII             NO       NO      NO      YES       0      .      0   
  6  ASCII             NO       NO      NO      YES       0      .      0   
  7  ASCII             NO       NO      NO      YES       0      .      0   
  8  ASCII             NO       NO      NO      YES       0      .      0   
  9  ASCII             NO       NO      NO      YES       0      .      0   
 10  ASCII             NO       NO      NO      YES       0      .      0   
 11  ASCII             NO       NO      NO      YES       0      .      0   


The OUT2= Data Set

The OUT2= option in the CONTENTS statement creates an output data set that contains information about indexes and integrity constraints. These are the variables in the output data set:
NUMVARS
the number of variables involved in the index or integrity constraint.

NAME
the name of the index or integrity constraint.

TYPE
the type. For an index, the value is "Index" while for an integrity constraint, the value is the type of integrity constraint (Not Null, Check, Primary Key, etc.).

RECREATE
the SAS statement necessary to recreate the index or integrity constraint.

MG
the value of MESSAGE=, if it is used, in the IC CREATE statement.

INACTIVE
contains YES if the integrity constraint is inactive.

ONDELETE
for a foreign key integrity constraint, contains RESTRICT or SET NULL if applicable (the ON DELETE option in the IC CREATE statement).

ONUPDATE
for a foreign key integrity constraint, contains RESTRICT or SET NULL if applicable (the ON UPDATE option in the IC CREATE statement).

REFERENCE
for a foreign key integrity constraint, contains the name of the referenced data set.

WHERE
for a check integrity constraint, contains the WHERE statement.

UNIQUE
contains YES if the UNIQUE option is defined for the index.

NOMISS
contains YES if the NOMISS option is defined for the index.

IC_BUILD
contains YES if the index was built by creating an integrity constraint.

IC_OWN
contains YES if the index is owned by the integrity constraint.

NUMVALS
the number of distinct values in the index (displayed for centiles).

UPERCMX
the percentage of the index update that triggers a refresh (displayed for centiles).

UPERC
the percentage of the index that has been updated since the last refresh (displayed for centiles).


Chapter Contents

Previous

Next

Top of Page

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