When an analysis is conducted between variables in multiple data files, Displayr needs to work out how observations in the data files relate to each other. That is, rules are needed by which to merge the data files.
This article describes how to edit an existing data file relationship.
Requirements
Please note these steps require a Displayr license.
A Displayr document containing two related datasets. To create a relationship between two files, there must be a variable in both files that contains the same type of data (text, categorical, dates, etc.) and has some values that match.
Method
To establish a relationship between two files:
- Click one of the two files you wish to link
- Use the Unique identifier menu to select the variable to match the files with.
- Click the Edit Relationships button
- Click the New button if the files have not already been linked.
Edit Relationship Dialog
- Use the two Data set menus to select the two files, and the two Variable menus to choose the common variable you are using to match the files, e.g., UniqueID. Note, both variables must contain the same type of data (text, categorical, date, etc.).
- Use the Relationship type menu to specify how the data should be matched across the data sets (in this example, the match is One to one):
- One to one: Each single value in the left variable matches exactly to a single value in the right variable.
- One to many: A single value in the left variable matches multiple values in the right variable.
- Many to one: Multiple values in the left variable match a single value in the right variable. This is the same type of relationship as One to many, with left and right sides swapped.
-
Many to many: Multiple values in the left variable match multiple values in the right variable, resulting in Data Fusion.
- Use the When a value is not found in the other data set menu to specify how you want to treat values that exist in one file but not the other. The choices are:
- Show a warning message (default) - When a respondent's value in the left variable cannot be found in the right variable (or the other way round), a warning is shown and you will not be able to proceed with the crosstab until you either fix the data or come back to this screen and select another option.
- Insert a missing values into the matched data - If a respondent's value in the left variable cannot be found in the right variable (or the other way round), the respondent is included in the sample as missing data (NaN) rather than their actual response data.
- Exclude cases from the matched data - If a respondent's value in the left variable cannot be found in the right variable (or the other way round), the respondent is excluded from the sample.
- Use the Match dates that fall in the same: menu for ways to treat dates for when a case in the left variable falls in the same year (or month, week or day) as the date for a case in the right variable.
- Use the Recipient menu to define the recipient when the relationship type between the two data sets is Many to many.
In this example, we indicate we want to be warned if a value can be found in one file but not the other.
- Click OK.
Note: if you receive a warning message, the message will tell you how to fix the problem before proceeding. For example, this message indicates that I need to either update the file, or click Properties > Edit relationships and choose another option for when a value is found in one file but not the other.
To fix this particular problem, I will insert missing values into the matched area.
- Click OK.
The results are as follows:
Diagnostics button
- Use the Diagnostics button, if you want to be warned in advance of problems you should fix prior to matching the files.
Performing an analysis between variables in different files
Now that the files are linked, I can use variables from both files in the same table. In this example, the Gender variable comes from the Demographics file, and the Preferred cola variable comes from the Cola Tracking - January to December file.
Next
How to Merge Files by Variable (Add New Variables)
Multiple Data Sets Video Guide