IN Subcommand (ADD FILES command)

IN creates a new variable in the resulting file that indicates whether a case came from the input file named on the preceding FILE subcommand. IN applies only to the file specified on the immediately preceding FILE subcommand.

  • IN has only one specification, the name of the flag variable.
  • The variable created by IN has the value 1 for every case that came from the associated input file and the value 0 for every case that came from a different input file.
  • Variables created by IN are automatically attached to the end of the resulting file and cannot be dropped. If FIRST or LAST are used, the variable created by IN precedes the variables created by FIRST or LAST.

Example

ADD FILES  FILE="/data/week10.sav" /FILE="/data/week11.sav" 
  /IN=INWEEK11 /BY=EMPID.
  • IN creates the variable INWEEK11, which has the value 1 for all cases in the resulting file that came from the input file week11.sav and the value 0 for those cases that were not in the file week11.sav.

Example

ADD FILES  FILE="/data/week10.sav" /FILE="/data/week11.sav" 
  /IN=INWEEK11 /BY=EMPID.
IF  (NOT INWEEK11) SALARY1=0.
  • The variable created by IN is used to screen partially missing cases for subsequent analyses.
  • Since IN variables have either the value 1 or 0, they can be used as logical expressions, where 1 = true and 0 = false. The IF command sets the variable SALARY1 equal to 0 for all cases that came from the file INWEEK11.