Sometimes when setting up surveys, you may want to create a tie-breaker question to clarify a favorite response from a multiple-response question, ONLY if the respondent selected multiple options (otherwise the single selection is the obvious favorite). However, when it comes time to analyze the favorite items, your data is now split between two variable sets. This article describes a method for combining the data in both sets to create a complete variable for the favorite selection based on both questions. For example, you may setup questioning like below:
Q8. Which airlines did you consider flying?
- Virgin Blue
- Other airlines
- IF HAS NOT BOOKED ON OWN: Don’t know 6
Q9. ASK IF MORE THAN 1 AIRLINE SELECTED IN Q8: And which airline did you end up flying?
- ASK IF CONSIDERED JETSTAR: Jetstar
- ASK IF CONSIDERED QANTAS: Qantas
- ASK IF CONSIDERED REX: Rex
- ASK IF CONSIDERED VIRGIN BLUE: Virgin Blue
- ASK IF CONSIDERED OTHER AIRLINES: Other airline
Will create data formatted as a Binary-Multi and Nominal variable set in Displayr:
To a Nominal variable set including the single selection favorites from the multiple-response question:
- A Binary-Multi and Nominal variable set with categories that overlap.
//Combine multiple-response and single response tie-breaker
//q8 is the Binary-Multi variable set and q9 is the tie-breaker Nominal variable set
//replace the variable names below with those of your variable sets
//be sure the number multiplied by the variable below (i.e. 2 for q8_B) corresponds
//to that category's Value in the Nominal variable
if (isNaN(q9)) q8_A + 2*q8_B + 3*q8_C + 4*q8_D + 5*q8_E; else q9;
- Click Calculate to run the code and give it a sensible Label.
- Change Structure > Nominal so it shows categories.
- Click on the Labels button and change the Label column to those of the corresponding categories from the original Q9 variable set. If there is a 0 value that is because Don't Know was selected in Q8 and thus Q9 should be missing data and excluded:
Now you can drag the new variable to the page to see the single selections for airlines considered flying (the only preference) and the airline that was flown (the ultimate preference).
Equivalently, the same thing can be achieved using else if statements:
if (isNaN(q9) && q8_A == 1) 1; else if (isNaN(q9) && q8_B == 1) 2; else if (isNaN(q9) && q8_C == 1) 3; else if (isNaN(q9) && q8_D == 1) 4; else if (isNaN(q9) && q8_E == 1) 5;