Working with SAS Data Sets

Displaying SAS Data Set Information

You can use SHOW statements to display information about your SAS data sets. The SHOW DATASETS statement lists all open SAS data sets and their status. The SHOW CONTENTS statement displays the variable names and types, the size, and the number of observations in the current input data set. For example, to get information for the CLASS data set, issue the following statements:

  
    > use class; 
    > show datasets; 
  
                 LIBNAME MEMNAME   OPEN MODE   STATUS 
                 ------- -------   ---------   ------ 
                 WORK    .CLASS    Input       Current Input 
  
    > show contents; 
  
                 VAR NAME   TYPE   SIZE 
                 NAME       CHAR     8 
                 SEX        CHAR     8 
                 AGE        NUM      8 
                 HEIGHT     NUM      8 
                 WEIGHT     NUM      8 
                 Number of Variables:    5 
                 Number of Observations: 19
 
As you can see, CLASS is the only data set open. The USE statement opens it for input, and it is the current input data set. The full name for CLASS is WORK.CLASS. The libref is the default, WORK. The next section tells you how to change the libref to another name.

Previous Page | Next Page | Top of Page