Previous Page | Next Page

SAS Data Set Options

IN= Data Set Option



Creates a Boolean variable that indicates whether the data set contributed data to the current observation.
Valid in: DATA step
Category: Observation Control
Restriction: Use with the SET, MERGE, MODIFY, and UPDATE statements only.

Syntax
Syntax Description
Details
Examples
See Also

Syntax

IN=variable


Syntax Description

variable

names the new variable whose value indicates whether that input data set contributed data to the current observation. Within the DATA step, the value of the variable is 1 if the data set contributed to the current observation, and 0 otherwise.


Details

Specify the IN= data set option in parentheses after a SAS data set name in the SET, MERGE, MODIFY, and UPDATE statements only. Values of IN= variables are available to program statements during the DATA step, but the variables are not included in the SAS data set that is being created, unless they are assigned to a new variable.

When you use IN= with BY-group processing, and when a data set contributes an observation for the current BY group, the IN= value is 1. The value remains as long as that BY group is still being processed and the value is not reset by programming logic.


Examples

In this example, IN= creates a new variable, OVERSEAS, that denotes international flights. The variable I has a value of 1 when the observation is read from the NONUSA data set. Otherwise, it has a value of 0. The IF-THEN statement checks the value of I to determine whether the data set NONUSA contributed data to the current observation. If I=1, the variable OVERSEAS receives an asterisk (*) as a value.

data allflts;
   set usa nonusa(in=i);
   by fltnum;
   if i then overseas='*';
run;


See Also

Statements:

BY Statement

MERGE Statement

MODIFY Statement

SET Statement

UPDATE Statement

BY-Group Processing in SAS Language Reference: Concepts

Previous Page | Next Page | Top of Page