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 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 instance, a row is added for a record), skip to '2. Merging study data and report data'.
1. Restructure report data to wide format
- Open your report file, e.g. 'report_bloodpressure.sav'.
Click Data > Restructure
Select 'Restructure selected cases into variables'. Click Next.
Select 'record_id' as Identifier Variable. Click Next.
Select Yes for 'Sort the current data?'. Click Finish. Every report variable will have a suffix '.X' with X being the number of the report instance.
To merge your study and report data, follow the steps below from 'Merge study data and report data'.
2. Merge study data and report 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' 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'.
- '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.
- Click 'OK'.