Getting Information about Your SAS Data Sets |
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.
Listing the Contents of One Data Set |
The SAS data library USCLIM contains four data sets, with the data set TEMPCHNG containing 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; run;
The CONTENTS statement produces a contents listing, and the DATA= option specifies the name of the data set. The following output shows the results from the CONTENTS statement, which are sent to SAS output rather than to the SAS log. Note that output from the CONTENTS statement varies for different operating environments.
Contents Listing for the Data Set TEMPCHNG
The SAS System The DATASETS Procedure 1 Data Set Name: USCLIM.TEMPCHNG Observations: 5 Member Type: DATA Variables: 6 Engine: V8 Indexes: 0 Created: 14:32 Wednesday, November 15, 2000 Observation Length: 56 Last Modified: 14:32 Wednesday, November 15, 2000 Deleted Observations: 0 Protection: Compressed: NO Data Set Type: Sorted: NO Label: -----Engine/Host Dependent Information----- 2 Data Set Page Size: 8192 Number of Data Set Pages: 1 First Data Page: 1 Max Obs per Page: 145 Obs in First Data Page: 5 Number of Data Set Repairs: 0 File Name: /u/userid/usclim/tempchng.sas7bdat Release Created: 8.0202M0 Host Created: HP-UX Inode Number: 14595 Access Permission: rw-r--r-- Owner Name: userid File Size (bytes): 16384 -----Alphabetic List of Variables and Attributes----- 3 # Variable Type Len Pos Format Informat --------------------------------------------------------- 2 Date Num 8 0 DATE9. DATE7. 6 Diff Num 8 32 4 End_f Num 8 16 5 Minutes Num 8 24 3 Start_f Num 8 8 1 State Char 13 40 $CHAR13.
The following list describes information that you might find in contents listing and corresponds to the numbered items in the preceding output:
In addition, if applicable, the output also displays a table that describes the following information:
Listing the Contents of All Data Sets in a Library |
You can list the contents of all the data sets in a library by specifying the keyword _ALL_ with the DATA= option. The following statements produce a directory listing in SAS output for the library and a contents listing for each data set in the directory:
contents data=_all_; run;
To send only a directory listing to SAS output, add the NODS option. The following statements produce a directory listing but suppress a contents listing for individual data sets. Use this form if you want the directory listing for the procedure input library:
contents data=_all_ nods; run;
Include the libref if you want the directory listing for another library. This example specifies the library STORM:
contents data=storm._all_ nods; run;
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.