Language Reference


SETOUT Statement

  • SETOUT SAS-data-set <NOBS name> <POINT value> ;

The SETOUT data set makes a data set the current output data set.

The arguments to the SETOUT 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

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

value

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

The SETOUT statement chooses the specified data set from among those data sets that are already opened for output by the EDIT or CREATE statement. (The SHOW DATASETS command lists these data sets.) This data set becomes the current output data set for subsequent data management statements.

If specified, the NOBS option returns the number of observations currently in the data set in the scalar variable name. The POINT option makes the specified observation the current one.

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

proc iml;
x = T(1:20);
create A var {x}; append;
setout A nobs size point 5;
list;                /* lists observation 10 */

Figure 25.373: Result of SETOUT Statement

   OBS         X                                                                                  
------ ---------                                                                                  
     5    5.0000