In SPSS, how do I concatenate files?

In SPSS, use the ADD FILES command to concatenate or append two or more data files. The files must be SPSS system files. To concatenate them simply, list the files to be merged using the /FILE subcommand. The concatenation follows the order of the files specified.

This first example adds three files called PART1.sav, PART2.sav, and PART3.sav in the c:\spssdata directory:

  ADD FILES
    /FILE="C:\spssdata\PART1.sav"
    /FILE="C:\spssdata\PART2.sav"
    /FILE="C:\spssdata\PART3.sav".
  EXECUTE.

You can also index the files on a specific variable (such as case ID) if you wish; this is called interleaving files. The files are organized on the variable ID, so that the final saved data set is indexed according to this shared variable. Notice that the order of the files read into SPSS is reversed, but the final product is the same due to the /BY subcommand.

  ADD FILES
    /FILE="C:\spssdata\PART3.sav"
    /FILE="C:\spssdata\PART2.sav"
    /FILE="C:\spssdata\PART1.sav"
    /BY=ID.
  EXECUTE.

If you have questions about using statistical and mathematical software at Indiana University, contact Research Analytics. Research Analytics is located on the IU Bloomington campus at Woodburn Hall 200; staff are available for consultation Monday-Friday 9am-noon and by appointment.

This is document aeqq in the Knowledge Base.
Last modified on 2015-06-19 00:00:00.

Contact us

For help or to comment, email the UITS Support Center.