In SPSS, how do I merge two files?
The most common form of merging is what SPSS calls a parallel "matched merge", where two files are sequentially organized and combined to create one large file. To complete this process, each file must contain the same shared unique identification variable; this is used to sort on and then to merge on. This variable is the key by which the final merged file will be organized, and serves as an index of the process (e.g., record number or ID number).
To implement the merge:
- Use the
SORT CASEcommand to sort each file you wish to merge on the index variable.
- After
sorting, use the
SAVE OUTPUTcommand to save each file to a systems file.
- Use the
MATCH FILEScommand to merge the files and create a single, final version of the file.
The following example of this process merges two files,
merge1.sav and merge2.sav, with the shared
index variable v1, into a final file,
sort.sav:
For other types of file merging or more information, see the SPSS Command Syntax Reference (in PDF format).
For more information about statistical and mathematical software, email the UITS Stat/Math Center, visit the center's web page, or phone 812-855-4724 (IUB) or 317-278-4740 (IUPUI). The center is located in Bloomington at 410 N. Park Avenue, and is open for consultation by appointment Monday-Friday 9am-5pm.
Last modified on May 13, 2009.







