Start a conversation

How can I merge study and report/survey data files in SPSS?

Before you follow the steps in this article, please make sure you have exported your data properly. See here how you can export to SPSS. Save your .sav files, e.g. 'studydata.sav' and 'reports_bloodpressure.sav'.

If you want to merge files in a wide format (i.e., for every report/survey instance, new columns are added), follow the steps below for '1. Restructure report data to wide format'. If you want to merge files in a long format (i.e., for every report/survey instance, a row is added for a record), skip to '2. Merging study data and report/survey data'.

1. Restructure report/survey data to wide format

  1. Open your report or survey file. In this example we'll use the report file 'report_bloodpressure.sav'.
  2. Click Data > Restructure

  3. Select 'Restructure selected cases into variables'. Click Next.


  4. Select 'record_id' as Identifier Variable. Click Next.

  5. Select Yes for 'Sort the current data?'. Click Finish. Every report/survey variable will have a suffix '.X' with X being the number of the report/survey instance.

  6. To merge your study and report/survey data, follow the steps below from 'Merge study data and report/survey data'.

2. Merge study data and report/survey data

  1. Let's say you want to merge the .sav files 'studydata.sav' and 'reports_bloodpressure.sav'.
  2. Make sure you sort the column 'record_id' in both files:
    • Right click on the name of the column.
    • Click 'Sort Ascending'.
  3. Open 'studydata.sav'.
  4. Click 'Data' > 'Merge files' > 'Add variables'.
  5. Select the dataset you want to merge, so e.g. 'reports_bloodpressure.sav'. Click 'Continue'.
  6.  Select:
    • 'Match cases on key variables'
    • 'Cases are sorted in order of key variables in both datasets'
    • 'Both files provide cases'
    • Select 'record_id' as key variable.
  7. Click 'OK'.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Castor Support Team

  2. Posted
  3. Updated