Merge study and repeating data/survey data files in SPSS in CDMS
Table of Contents
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 repeating data/survey instance, new columns are added), follow the steps below for '1. Restructure repeating 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'.
Restructure repeating data/survey data to wide format
- Open your repeating data or survey file. In this example we'll use the repeating data file 'report_bloodpressure.sav'.
Click Data > Restructure
Select 'Restructure selected cases into variables'. Click Next.
Select 'record_id' ('participant_id') as Identifier Variable. Click Next.
Select Yes for 'Sort the current data?'. Click Finish. Every repeating data/survey variable will have a suffix '.X' with X being the number of the report/survey instance.
To merge your study and repeating data/survey data, follow the steps below from 'Merge study data and repeating data/survey data'.
2. Merge study data and repeating data/survey data
- Let's say you want to merge the .sav files 'studydata.sav' and 'reports_bloodpressure.sav'.
- Make sure you sort the column ‘record_id’ ('participant_id') in both files:
- Right click on the name of the column.
- Click 'Sort Ascending'.
- Open 'studydata.sav'.
- Click 'Data' > 'Merge files' > 'Add variables'.
- Select the dataset you want to merge, so e.g. 'reports_bloodpressure.sav'. Click 'Continue'.
- Select:
- 'Match cases on key variables'
- 'Cases are sorted in order of key variables in both datasets'
- 'Both files provide cases'
- Select 'record_id'('participant_id') as key variable.
- Click 'OK'.