02 May 2019 | by Oliver Harrison

Tips for Merging Questions in Q Without Writing Syntax

There are often occasions in market research when you look at your survey data and find that in order to analyse certain questions properly, you’ll need to manipulate your data. For example, you may need to merge questions together. In this post, I’ll show you how to use Q to merge your data without having to manually write syntax.

Q’s Merge Questions function

The most helpful function in this case is called Merge Questions. To use it, you simply need to go into the Variables and Questions tab, highlight the questions you wish to merge, right-click and press Insert Ready-Made Formula(s) > Merge Questions. Q does the work for you!

This function works with single and multiple response questions, or Pick One and Pick Any questions. It also matches on labels so it is important to ensure consistent labeling, otherwise it will treat different spellings as different code options and append them to your merged question rather than automatically merging them for you. A common case for using this function is to merge ‘First mention’ with ‘Other mentions’ to create a ‘Total mentions’ question. It is important to note that if you merge with a Pick Any question, you will produce a Pick Any, but if you merge a Pick One with a Pick One, you will produce only a Pick One.

Merging non-mutually exclusive data

In the example below, I have two Pick One questions, Q1 and Q2, in which some respondents have answered one question only and some have answered both. I wish to merge these questions together and both have identical code labels. As already mentioned, I only need to select the two questions and use the Insert Ready-Made Formula(s) > Merge Questions option to create ‘Merged Q1 + Q2’.

When I bring this merged question up as a table, I can see that it has included an extra code option called BOTH INPUT QUESTIONS HAVE DATA. If this code has any cases in it, then it means the questions being merged had overlapping data and therefore should not be merged into a single variable. If there is no data here, this option can be removed instead by right-clicking it in the table and selecting Remove.

If your data is not mutually exclusive and is in Pick One format, then it is best to first convert one of your questions into a Pick Any via Insert Ready-Made Formula(s) > Questions -> Pick Any with All Combinations. This will then ensure that Q merges your data correctly as a multiple response question.

Merging Tie-breaker or “Most often” questions with a previous multiple response question

In the next example, I have two questions: Q3 -“Which of the following brands do you regularly use?” and Q4 – “Which of the following brands do you use most often?” Q4 was only asked of those who chose multiple brands at Q3 so it is missing the data of those who selected only one brand. To merge this data into Q4, you could go down the path of writing JavaScript code but you can save a lot of time and the effort of manual syntax by using Q’s built-in functions.

First create a filter for those with a single brand at Q3 using the following steps:

  1. To count the number of responses at Q3, go into the Variables and Questions tab, highlight the Q3 variables, right-click and select Insert Ready-Made Formula(s) > Mathematical Functions (by Case) > Sum > Yes
  2. Then change the Variable Type for this sum variable to Categorical and bring it up as a table so that it shows a percentage of counts.
  3. Now, right-click the % cell adjacent to the ‘1’, right-click, and press Create filter to create a filter for single response records. I have chosen ‘Q4 single brand’ as the name here.

Next, we will filter Q3 by ‘Q4 single brand’:

  1. Go to Automate > Browse Online Library > Filtering > Filter One Question by Another Question to run the filtering script.
  2. Select Q3 as the question you want to filter on the first screen.
  3. Select the filter variable ‘Q4 single brand’ on the second screen.
  4. Press Yes to filter all question variables by the specified filter.

This will produce a table of Q3 filtered by ‘Q4 single brand’ at the bottom of your Report tree for those with only one response.

Now we will merge the filtered Q3 with Q4:

  1. Q will match based on the variable and value labels so you should first ensure the labels in both questions are consistent and match for all the options you want to merge together.
  2. Highlight these two questions in the Variables and Questions tab, right-click and select Insert Ready-Made Formula(s) > Merge Questions > Yes/No (depending on whether you wish to hide the original questions from the blue and brown drop-downs).

This will then produce a merged Pick Any question.

Author: Oliver Harrison

After completing a PhD in German history and literature, Oliver swapped old dusty books for computer screens and logic. He then enjoyed the next 10 years as a survey programmer and data analyst in the Australasian market research industry. Today Oliver is passionate about problem-solving and helping customers achieve their goals as a member of the Customer Success team at Displayr.

No comment. Share your thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep updated with the lastest in market research

* indicates required