Sometimes two variables will have been set up so that they have the same Labels, but different Values associated with their labels. For example, Q1 may have 1 Yes and 2 No, while Q2 may have 1 No and 2 Yes. If Combine is used to create a Variable Set using these variables, the labels will be taken from the first of the variables, which will mean that the table provides misleading results (you will get a warning). Note that even if you change the Value Attributes, when you combine variables (usually Nominal into a Nominal-Multi) the original source values will be used, and you will receive a warning "Fundamentally Different Variables", and you will need to use the method below.
Method
- Recode the values so that they align. In the example above, this means replacing the Value for No with a 2 and Yes with a 1 for Q2.
- Select the variable in Data Sources and click + > Custom Code > JavaScript > Nominal.
- Select the newvariable in Data Sources and give it a descriptive label in General > Label in the Object Inspector
.
- In the JavaScript code editor, type in the Name of the variable from Step 1.
- Click Calculate in the object inspector
.
- Repeat Steps 2 through 4 for every variable that needs to be copied.
- Select the existing variables that were not recoded, and the copies of the recoded variables, right-click, and select Combine.
The logic behind this is as follows:
- When you use Combine, Displayr does not look at the actual Values. Instead, it looks at the Source Values (i.e., the values prior to any recoding). This is often useful as it permits Combine to work even when you have recoded data such that multiple Labels share a single Value (e.g., if computing NPS).
- When you create the new JavaScript variable and connect it back to the original variable, that new variable refers back to the Values, not the Source Values of the previous variable. As these values have been changed by the recoding, the Source Values of the JavaScript variable will now reflect what is required.