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, several strategies can be used.
Requirements
- A professional user license
- Files to be merged must be stored on the Displayr Cloud Drive.
- Files to be merged must be .sav files
Method - Liaise with the data file provider
Often, when data files do not match, it is due to an error by the person who created the 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.
Method - Using the GUI (Displayr interface)
- From the toolbar, go to Anything
> Data > Data Set > Combine > By Case.
- In Properties
> Data > Data sets > Data set 1, click Select file...
- Select the first data set from the file selector and click OK.
- In Properties
> Data > Data sets > Data set 2, click Select file...
- Select the second data set from the file selector and click OK.
- Click
- Click Combined data set name > Save as....
- Give the combined data set a File name and click Save.
Automatic updating
If your input data sets will be periodically updated in the Cloud Drive, you can set this as a repeatable workflow that automatically combines the latest input data sets and exports the combined data file to the Cloud Drive. This can be achieved by adding a schedule to your Data - By Case output.
Add the data set to your document
Once the output has run, it will save the combined data set to your Displayr Cloud Drive using the name you specified. You can then do one of the following to add this data set to your document, depending on your requirements.
Add a new data set
- Click the
icon in the Data Sources tree.
- Select Cloud Sources > Displayr Cloud Drive.
- Select the combined data set from the list of files and press OK.
Update an existing data set
- Select the original data set that you would like to update with the merged file in the Data Sources tree.
- From the floating toolbar, click Update
, or from Properties
, click Update.
- Select Displayr Cloud Drive.
- Select the combined data set from the list of files and press OK.
- A Data Difference Warning may appear to alert you to any changes to the data set. Review these results and click Accept or Remind Me Later.
- The data set and any connected outputs will now be updated with the combined data.
Method - Copying and renaming
The basic idea is to rename all variables in one file to match those in the other file.
- Import the data file that contains the variables that you wish to rename.
- In the Data Sources tree, select all the variables that you wish to rename.
- Right-click and select Duplicate.
- Rename the variables. If you are good with JavaScript, you can do this programmatically, but in most cases, manually changing it will be easiest and fastest.
- Hide the original variables in the data file.
- Export as an SPSS data file.
- Merge the files.
UPCOMING WEBINAR: How to Hand Half Your Job to AI (the Right Half)