This article describes how to merge files by variable.
In this example, two files census_05_demographics_men_women.sav and census_05_attitudes.sav were merged. Variables with the black box in the first column came from the demographics file and those on the second column from the attitudes files. Both files have a common variable called ID.
- A professional user license
- Files to be merged must be stored on the Displayr Cloud Drive
- FIles to be merged must be .sav files
File name specification
- Select Anything > Data > Data Set > Combine > By Variable.
- In Inputs > Data sets, type the name of the first file on the Cloud Drive in the Data set 1 box.
- In Inputs > Data sets, type the name of the second file on the Cloud Drive in the Data set 2 box.
- Type the name of the merged data set in the Combined data set name box. By default, it will be called Combined data set.sav.
You can either Combine data sets by Matching IDs or joining them side-byside (no matching). The latter method is useful if both files have the same cases but do not have an ID variable. Case 1 will be matched with Case 1, Case 2 with Case 2, etc. You should only use this method if the cases in both files are in the same order and both files have the same number of cases.
It is usually preferable to match by an ID variable if one is available. If you are using this method, when entering the ID variable fields, you will need to use the variable Name (not label).
Specify the names of the variables that should or should not be combined. Also, the variables that should be manually included or omitted from the combined data set.
Use Automatic updating if you want the merge to refresh automatically after a specified time period.
Once the merge has been performed and is successful, the new merged file is automatically saved to the Cloud Drive using the combined data set name given at Step 4:
You can now update your existing data set with the merged file by:
- Select the original data set that you would like to update with the merged file in the Data Sets tree.
- From the object inspector, click Update.
- Select Displayr Cloud Drive.
- Select the merged data set from the list of files and click OK.
- A Data Difference Warning may appear alerting you of any changes to the data set. Review these results and click Accept or Remind Me Later.
- The data set and outputs that you created will be updated with data from the combined data set.