SPSS Match Files
The MATCH FILES command joins datasets.
Contents
Usage
match files /file=left /file=right /by KEYVARS.
The final dataset contains all rows and columns from all datasets. Variables are taken in order, from datasets in order. If a variable is present in more than one dataset, values are taken from the first dataset they appear in and metadata is taken from the first dataset with any (i.e. variable label, value labels, or missing values) metadata set.
The key variables must be defined with the same format (including length for string variables) in each dataset. Cases must be uniquely identified by the key variables in each dataset, except if using the /TABLE subcommand, in which case this is only required of the dataset specified on the /TABLE subcommand itself.
Each dataset must be presorted by the key variables.
File
Each /FILE subcommand takes one of:
a star (*) indicating the active data set
- the name of a data set
a filename or file handle
If the active dataset is included in a join and referenced by a star (*), that dataset will be modified in-place by the join.
If the active dataset is included in a join and referenced by name, the final dataset will retain the name.
If the active dataset is not included, the final dataset is unnamed and becomes the active dataset.
Table
The MATCH FILES command has an extension through the /TABLE subcommand. It can be used to join lookup tables.
match files /file=foo /table=states /by statecode.
Each /TABLE subcommand takes one of:
- the name of a data set
- a filename or file handle
