BY Subcommand (MATCH FILES command)

BY specifies one or more identification, or key, variables that determine which cases are to be combined. When BY is specified, cases from one file are matched only with cases from other files that have the same values for the key variables. BY is required unless all input files are to be matched sequentially according to the order of cases.

  • BY must follow the FILE and TABLE subcommands and any associated RENAME and IN subcommands.
  • BY specifies the names of one or more key variables. The key variables must exist in all input files. The key variables can be numeric or long or short strings.
  • All input files must be sorted in ascending order of the key variables. If necessary, use SORT CASES before MATCH FILES.
  • Missing values for key variables are handled like any other values.
  • Unmatched cases are assigned system-missing values (for numeric variables) or blanks (for string variables) for variables from files that do not contain a match.