Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Repeated questions > How loops and grids work
 
How loops and grids work
When you define a loop or a grid, you specify the number of times the questions in the loop or grid are to be repeated by defining either a set of categorical values or a numeric range. These values are called the loop control list. The loop can contain any number of questions of any type.
When the interviewing program encounters a loop (see Categorical loops) with a list of categorical values, it repeats the questions in the loop once for each categorical value. If the loop contains more than one question, all questions are displayed on the same page, but you can force questions onto separate pages. The first repetition uses the first categorical value in the loop control list, the second repetition uses the second categorical value in the loop control list, and so on. After the last question has been asked for the last categorical value in the control list, the interviewing program continues with the next statement in the routing section.
If you substitute the current loop control value in the question text, you will have a set of unique questions that could have been defined as completely separate questions. So, for example, a loop that repeats a question asking how many journeys the respondent made, and that is repeated for the categories train and car, has the same effect as writing one question that asks about train journeys and another question that asks about car journeys. The advantage of using a loop is that it makes analysis of the data across all questions in the loop easier. For example, if the data were available you could calculate the total number of journeys made or the average journey length as part of the analysis phase of the project.
Numeric loops whose control list is numeric behave a similar way, except that the questions are repeated for every value within the specified range. This is the ideal way of repeating questions a fixed number of times without the number of repetitions being related to anything in particular. For example, in a product test, you might have asked respondents to try a different product each week over a period of four weeks. To find the order in which products were tested, you could write a loop that asks the question “Which product did you try first/next?” and repeat it four times.
Most loops can be presented as grids. For example, in a product test you might want to know the order in which the products were tested (numeric), a rating (categorical), and what the respondent liked about each product (text). If you choose to present these questions as a grid, the interviewing program displays all three questions side by side as a table on a single page.
When a categorical question such as a rating question is displayed as a grid, the items to be rated (defined as categories in the loop control list) form one dimension of the grid and the responses to the question form the other dimension. Thus, a product rating grid might show the products as the columns of the grid (these come from the loop control list) and the ratings as the rows of the grid (these come from the question definition).
When a numeric or text question is displayed as a grid, each cell of the grid contains an input box in which the respondent enters a numeric or text value as appropriate. As an example, suppose you want to ask respondents how many times they took various forms of exercise during the last week and the last month. You define one numeric question for each activity and place the values “last week” and “last month” in the loop control list. The grid then provides one cell for each combination of activity and time period.
See also
Repeated questions