SETIN Statement

SETIN SAS-data-set <NOBS name> <POINT value> ;

The SETIN data set makes a data set the current input data set.

The arguments to the SETIN statement are as follows:

SAS-data-set

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. See the example for the CLOSE statement.

name

is the name of a variable to contain the number of observations in the data set. The NOBS option is optional.

value

specifies the current observation. If the POINT option is not specified, the current observation does not change.

The SETIN statement chooses the specified data set from among the data sets that are open for input by the EDIT or USE statement. (The SHOW DATASETS command lists these data sets.) This data set becomes the current input data set for subsequent data management statements.

If specified, the NOBS option returns the number of observations in the data set in the scalar variable name. The POINT option points the data set to a particular observation and makes it the current observation.

In the following example, the data set WORK.A has 20 observations. The SETIN statement sets the variable SIZE to 20 and sets the current observation to 10.

proc iml;
x = T(1:20);
create A var {x}; append; close A;

use A;
setin A nobs size point 10;
list;                /* lists observation 10 */

Figure 23.315: Result of SETIN Statement

   OBS         X                                                                
------ ---------                                                                
    10   10.0000