Loops

What Is It?

Question loops allow you to repeat the same sequence of questions multiple times. For every loop iteration, different text is displayed, based upon answers to a previous question or a list you create.

Loops are indicated in the Designer Pane flowchart by a connector arrow. All questions within the arrows will be repeated for each answer selected in the first question (the loop driver).

Example of Use

Q10. Which of the following brands have you used?
Please select ALL that apply
1. Brand 1
2. Brand 2
3. Brand 3
4. Brand 4
5. Brand 5
6. Brand 6
7. Brand 7
8. None

Q11a. How would you rate your overall satisfaction with [insert brand used in Q10]?
Please select ONE only
1. Excellent
2. Very Good
3. Good
4. Fair
5. Poor

Q11b. What, if anything, could [insert brand used in Q10] do increase your level of satisfaction?
Please type in your answer below

In the above example, you would like to ask Q11a and Q11b for all options selected in Q10. Also, you would like to insert the brand name as conditional text in Q11a and Q11b. One option for setting this up would be to create separate questions for Q11a and Q11b for each option in Q10 - with two questions being asked of a possible seven brands, that would require a total of 14 variables! Give that questions Q11a and Q11b are the same for each brand selected in Q10, the most efficient way in which to ask Q11a and Q11b is with looping.

How Do I Use This?

Definition of terms:

Loop Driver - the variable that will feed into the loop (Q10 in the above example). The loop driver must be a Multi object.

Loop Iteration - the process of repeating a sequence of questions (in the above example, there are seven brands in the Q10 loop driver, so there will be up to seven loop iterations where Q11a and Q11b are asked).

To create a loop:

  1. Set up the loop driver:
    • Drag and drop a Multi question to the Designer Pane.
    • Enter the question details, including variable name, variable label, question text and answer codes.
    • If required, randomize all answer codes.
    • If you don't wish to display the loop driver question on the screen to respondents, hide the question and specify the desired action command.
  2. Add the question/s that you wish to be repeated for each value in the looping variable.
    • For each of these questions, you will need to display the answer code label that applies to the current loop driver value somewhere within the question text (e.g. "How would you rate your overall satisfaction with @Q1_CurrentLabel..."). You may wish to make the font bold or a different colour to clearly differentiate between loop iterations.
  3. Create the loop:
    • Right mouse-click on the looping variable question to access the Quick Menu, and select the Create Loop option to open the Question Looping dialogue box.
    • Select the last question you wish to include in within the loop via the drop-down box and click 'OK'. The loop will now be indicated in the Designer Pane by a connector arrow.
    • Click on the loop driver in the designer pane and check the Use Loop Prefix box in the properties pane (this property is found in the Loop section of the properties pane). This will ensure that answers to the questions are reset for subsequent loop iterations.

Loop Driver Action Commands

In the example above, the loop driver question will be displayed to respondents, so the loop iterations will be driven by what the respondent selects. In some surveys, you may wish to set the answers to the loop driver automatically. In this case, you will need to set an action command and hide the loop driver question.

To select all answers in the loop driver, use the SET action command to select all available answers. Remember to randomise all answer codes if you wish present loop iterations in a "shuffled" order.

To select a subset of answers in the loop driver, use the SET action command to select the required number of answers. Remember to randomise all answers in the loop driver question, otherwise only the first codes will ever be selected.

For more information, see Action Commands

Loop Limit

In the example above, the loop driver question will be displayed to respondents. The number of loop iterations will be dependent on how many answers are selected. Sometimes you may wish to limit the number of loop iterations, especially when the list of possible answers to the loop driver question is long. To do this, click on the loop driver object in the Designer Pane, and then enter the maximum number of loop iterations required in the Loop Limit property (this property is found in the Loop section of the properties pane).

In the above example, there are 7 possible answers that can be given to the loop driver question (Q10). By default, anyone who selects all 7 answers in Q10 will be asked Q11a and Q11b a total of 7 times. To minimize respondent fatigue, we may wish to limit the maximum number of loop iterations to three, so that regardless of how many answers selected in Q10, respondents will only be asked Q11a and Q11b for a maximum of three of the brands selected in Q10 (those who have only selected one brand in Q10 will only be presented with Q11a and Q11b once). Remember to randomise all answers in the loop driver question to ensure that all codes have an equal chance of being included in the loop.

Flagging the Order of Presentation of Loop Iterations

Survey Shaper's default settings do not enable the order of presentation of loop iterations to be determined when the loop driver question has been randomised. In other words, it would not be possible to determine from the data which of the loop items was asked first, second, third, etc. However, it is possible to flag the order of presentation of loop items by including a loop iteration stamp in the survey.

To include a loop iteration stamp:

  1. Drag and drop a Verbatim object to the Designer Pane to the position immediately following the loop driver question in the flowchart
  2. Right mouse-click on the object and select Action Command from the Quick Menu
  3. Enter a RECODE action command to insert the current value of the loop driver (Q10 in this example)
  4. Click OK to close the Action Command dialogue box and save the survey
  5. Once you have tested the action command, remember to hide the question so it is not presented to respondents.

Example of data structure:

Filtering Questions Within a Loop

Filtering based on the answer to a question within a loop

Using the above example, say you want Q11b to only be asked for brands that are given only a "fair" or "poor" rating in Q11a. A filter would need to be applied to Q11b. Filters within loops, however, require the current values of both the filter variable (Q11a) and the loop driver (Q10) to be taken into account.

The Q11b filter for the above example (where there are 7 possible responses to the loop driver Q10) would therefore be:

(@Q10_CurrentAnswer=1 and @Q10_loop_1_Q11a>3) or (@Q10_CurrentAnswer=2 and @Q10_loop_2_Q11a>3) or (@Q10_CurrentAnswer=3 and @Q10_loop_3_Q11a>3) or (@Q10_CurrentAnswer=4 and @Q10_loop_4_Q11a>3) or (@Q10_CurrentAnswer=5 and @Q10_loop_5_Q11a>3) or (@Q10_CurrentAnswer=6 and @Q10_loop_6_Q11a>3) or (@Q10_CurrentAnswer=7 and @Q10_loop_7_Q11a>3)

Where:

  • @Q10_CurrentAnswer represents the current value of the loop driver (Q10)
  • @Q10_loop_1_Q11a represents the answer provided to Q11a for the first value in the loop driver (i.e. Q10, Brand 1)
  • @Q10_loop_2_Q11a represents the answer provided to Q11a for the second value in the loop driver (i.e. Q10, Brand 2)
  • @Q10_loop_3_Q11a represents the answer provided to Q11a for the third value in the loop driver (i.e. Q10, Brand 3)
  • @Q10_loop_4_Q11a represents the answer provided to Q11a for the fourth value in the loop driver (i.e. Q10, Brand 4)
  • @Q10_loop_5_Q11a represents the answer provided to Q11a for the fifth value in the loop driver (i.e. Q10, Brand 5)
  • @Q10_loop_6_Q11a represents the answer provided to Q11a for the sixth value in the loop driver (i.e. Q10, Brand 6)
  • @Q10_loop_7_Q11a represents the answer provided to Q11a for the seventh value in the loop driver (i.e. Q10, Brand 7)

Filtering based on the loop iteration

Again using the above example, say you want Q11b to only be asked for the first loop iteration. A filter would need to be applied to Q11b based on the current value of the loop driver (Q10).

The Q11b filter for the above example would therefore be:

@Q10_Current=1

Where:

  • @Q10_Current represents the loop iteration number

Things To Consider

If you wish to present the questions within the loop on a single page, the looping variable should not be placed on the same page as the questions that need to be repeated for each value in the looping variable.

At present, it is not possible in Survey Shaper to display conditional text with in a loop, except for the value of the loop driver question (@loopdriver_CurrentLabel).