Adding Cases from Different Data Sources (ADD FILES command)

You can add cases from any data source that IBM® SPSS® Statistics can read by defining dataset names for each data source that you read (DATASET NAME command) and then using ADD FILES to add the cases from each file. The following example merges the contents of three text data files, but it could just as easily merge the contents of a text data file, and Excel spreadsheet, and a database table.

Example

DATA LIST FILE="/data/gasdata1.txt"
  /1 OZONE 10-12 CO 20-22 SULFUR 30-32.
DATASET NAME gasdata1.
DATA LIST FILE="/data/gasdata2.txt"
  /1 OZONE 10-12 CO 20-22 SULFUR 30-32.
DATASET NAME gasdata2.
DATA LIST FILE="/data/gasdata3.txt"
  /1 OZONE 10-12 CO 20-22 SULFUR 30-32.
DATASET NAME gasdata3.
ADD FILES FILE='gasdata1'
  /FILE='gasdata2'
  /FILE='gasdata3'.
SAVE OUTFILE='/data/combined_data.sav'.