This article describes how to merge data files when each file needs to be merged using two different variables (e.g., a respondent ID variable and an observation number).
Requirements
Two or more data files with different ID variables that you want to merge.
Method
- Import the first file into Displayr
- From the Data Sets tree by hovering over any variable > Plus (+) > Insert Variable(s) > Custom Code > JavaScript - Numeric / JavaScript - Text.
-
Select the newvariable and in Properties > General, fill in the fields as follows and press OK.
- Name: CombinedId (you can use any name)
- Label: Combined ID variable (you can use any label)
- Expression: id1 + " " + id2 (replace the variable names with your names)
- Select Publish > Export Data > Download as SPSS File and save the file somewhere.
- Repeat the previous steps for the second file.
- Merge the two files in the normal way (see Merging Data Files).
Next
How to Use JavaScript in Displayr