You can use the SHOW statement 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, the following statements display information about the Sashelp.Class
data set:
use Sashelp.Class; show datasets;
Figure 7.3: Open Data Sets
LIBNAME MEMNAME OPEN MODE STATUS -------- -------------------------------- --------- -------- SASHELP CLASS Input Current Input |
As shown in Figure 7.3, Sashelp.Class
is the only data set that is open. The USE statement opens the data set for input and makes it the current input data set.
You can see the names of variables, their lengths, and whether they are numeric or character by using the SHOW CONTENTS statement, as follows:
show contents;
Figure 7.4: Variable Names and Types
DATASET : SASHELP.CLASS.DATA LABEL : Student Data VARIABLE TYPE SIZE -------------------------------- ---- ---- Name char 8 Sex char 1 Age num 8 Height num 8 Weight num 8 Number of Variables : 5 Number of Observations: 19 |
The five variables are shown in Figure 7.4. Name
and Sex
are character variables; Age
, Height
, and Weight
are numeric variables. The variable Sex
has length 1, which means that each observation contains a single character.