TABLE Subcommand (MATCH FILES command)

TABLE specifies a table lookup (or keyed table) file. A lookup file contributes variables but not cases to the new active dataset. Variables from the table file are added to all cases from other files that have matching values for the key variables. FILE specifies the files that supply the cases.

  • A separate TABLE subcommand must be used to specify each lookup file, and a separate FILE subcommand must be used to specify each case file.
  • The BY subcommand is required when TABLE is used.
  • All specified files must be sorted in ascending order of the key variables. If necessary, use SORT CASES before MATCH FILES.
  • A lookup file cannot contain duplicate cases (cases for which the key variable[s] named on BY have identical values).
  • An asterisk on TABLE refers to the active dataset.
  • Dataset names instead of file names can be used to refer to currently open datasets.
  • Cases in a case file that do not have matches in a table file are assigned system-missing values (for numeric variables) or blanks (for string variables) for variables from that table file.
  • Cases in a table file that do not match any cases in a case file are ignored.

PASSWORD Keyword

The PASSWORD keyword specifies the password required to open an encrypted IBM® SPSS® Statistics data file. The specified value must be enclosed in quotation marks and can be provided as encrypted or as plain text. Encrypted passwords are created when pasting command syntax from the Save Data As dialog. The PASSWORD keyword is ignored if the file is not encrypted.

For an alternative to MATCH CASES with table lookup files that does not require sorting on key variables, see STAR JOIN.

Example

MATCH FILES FILE=* 
  /TABLE='/data/master.sav' 
  /BY EMP_ID.
  • MATCH FILES combines variables from the IBM SPSS Statistics data file master.sav with the active dataset, matching cases by the variable EMP_ID.
  • No new cases are added to the active dataset as a result of the table lookup.
  • Cases whose value for EMP_ID is not included in the master.sav file are assigned system-missing values for variables taken from the table.