The tools for Merging Data Files by adding cases assume that the variable names in the files are consistent. For example, they assume that if age is stored in q1 in one file, the other file will use the exact same Variable Name. Where this is not the case, there are a number of strategies that can be used.
Liaise with the data file provider
Often when data files do not match, it is a result of an error by the person who created the data file. It is often useful to get them to fix the problem, as in addition to solving the problem with the variable names mismatching, they may fix other problems that you have yet to discover at the same time.
Using the GUI
You can use drag and drop to match variables in the Merging Data Files dialog box. Although it can feel painfully slow when there are a large number of variables, provided that you drag multiple variables at the same time, this is often the fastest approach.
Copying and renaming
The basic idea is to rename all the variables in one file to match those in the other.
- Import the data file that contains the variables that you wish to rename, selecting No to any questions that you are asked when importing.
- In the Variables and Questions tab, select all the variables that you wish to rename.
- Right-click and select Copy and Paste Question(s) > Exact Copy.
- Press to move the variables to the top.
- Hide the original variables in the data file.
- Export as an SPSS data file.
- Merge the files.
Article is closed for comments.