Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

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:

  1. Use the SORT CASE command to sort each file you wish to merge on the index variable.

  2. After sorting, use the SAVE OUTPUT command to save each file to a systems file.

  3. Use the MATCH FILES command 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:

GET FILE = merge1.sav. SORT CASE BY v1. SAVE OUTFILE = merge1.sav. GET FILE = merge2.sav. SORT CASE BY v1. SAVE OUTFILE = merge2.sav. MATCH FILES /FILE=merge1.sav /FILE=merge2.sav /BY v1. SAVE OUTFILE = 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.

This is document aeqf in domain all.
Last modified on May 13, 2009.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.