USE
SAS-data-set <VAR operand> <WHERE(expression)> <NOBS name> ;
The USE statement opens a SAS data set for reading.
The arguments to the USE statement are as follows:
can be specified with a one-level name (for example, A) or a two-level name (for example, Sasuser.A). You can also specify an expression (enclosed in parentheses) that resolves to the name of a SAS data set.
specifies a set of variables. As described in the section Select Variables with the VAR Clause, you can specify variable names by using a matrix literal, a character matrix, an expression, or the _ALL_, _CHAR_, or _NUM_ keywords.
specifies a criterion by which certain observations are selected. If the WHERE clause is omitted, no subsetting occurs. The optional WHERE clause conditionally selects observations that are contained within the range specification. For details about the WHERE clause, see the section Process Data by Using the WHERE Clause.
specifies a variable to contain the number of observations. The NOBS clause returns the total number of observations in the data set in the variable name.
If the data set has not already been opened, the USE statement opens the data set for read access. The USE statement also makes the data set the current input data set so that subsequent statements act on it. The USE statement optionally can define selection criteria that are used to control access.
The VAR and WHERE clauses are optional, and you can specify them in any order. If a data set was previously open, all the data set options are still in effect. To override any old options, the new USE statement must explicitly specify new options.
The following examples demonstrate various options of the USE statement:
use Sashelp.Class; use Sashelp.Class var{name sex age}; use Sashelp.Class var{name sex age} where(age>10);
The data sets can be specified with a literal value as in the previous example, or with an expression (enclosed in parentheses) that resolves to the name of a SAS data set, as shown in the following statements:
f = "Sashelp.Class"; use (f); /* expression */ read all var _NUM_ into X; close (f);