Professional > Interview scripting > Writing interview scripts > Repeated questions > Categorical loops
 
Categorical loops
Write a categorical loop when you want to repeat a question or set of questions for a number of categorical values; for example, when you want to know how frequently respondents read the different sections of their newspaper, or when you want respondents to give their opinions on a number of statements.
To define a categorical loop
Put the following statement in the metadata section of the interview script:
LoopName ["GridHeaderText"] loop
{

  Categorical texts
} fields ["NonGridHeaderText"]
(
  Questions
) expand;
Parameters
LoopName
The name of the loop.
GridHeaderText
Optional text that refers to all questions in the loop, and that is used only when the loop is displayed as a grid. If there is only one question in the loop, this text is displayed as the question text and the text defined in the question is ignored. If the loop contains more than one question, this text is displayed above the grid as a whole and the texts defined inside the questions are displayed in the grid itself. The interviewing program ignores this text when questions are displayed as a series of repeated pages.
Categorical texts
The texts for which the questions in the loop are to be repeated. You may use a shared list here.
Questions
The questions you want to repeat, optionally with no question text defined.
NonGridHeaderText
An optional text that refers to all questions in the loop, and that is used only when the loop is displayed as a series of repeated pages rather than as a grid. This text is displayed at the top of the page, followed by the texts and response lists of the questions in the loop. The interviewing program ignores this text when questions are displayed as a grid.
Example
Here is the loop that asks respondents whether they have used the internet to obtain quotations for various types of insurance.
InsuranceType "" define
{
Car, Health, Buildings, Contents, Travel
};
InsuranceType1 "Insurance Type" loop
{
use InsuranceType
} fields (
InternetQuote "Have you ever used the internet to obtain quotes
for {@InsuranceType1} insurance?" categorical [1..1]
{Yes, No};
) expand;
If you present the question as a loop, the InternetQuote question is repeated five times, once for each section in the loop control list, and each time the current section name is substituted in the question text. Notice how the example uses {@InsuranceType1} to represent the current value of the loop control variable (InsuranceType1) in the question text. This type of specification is particularly suited to CATI interviews where the interviewer reads the text of each question to the respondent.
For self-completion Web interviews, you may prefer to use a grid layout. To achieve the best effect, move the question text to the start of the loop and reword it as follows.
InsuranceType "" define
{
Car, Health, Buildings, Contents, Travel
};
InsuranceType2 "Will you use the internet to compare prices
when your insurance for the following becomes due?" loop
{
use InsuranceType
} fields (
WillUseInternet "WillUseInternet" categorical [1..1]
{Yes, No};
) expand;
This produces the following grid:
To make a grid more attractive, you can use styles and templates: See Grids, Default styles for grids, and Grid templates.
The loop control texts form the rows and the response texts form the columns. This is the default layout and is the equivalent of placing the row keyword after the closing parenthesis at the end of the fields specification. To generate a grid that has the loop control texts as the columns and the response texts as the rows, place the column keyword after the closing parenthesis at the end of the fields specification. The specification for the previous example would therefore become:
InsuranceType "" define
{
Car, Health, Buildings, Contents, Travel
};
InsuranceType2 "Will you use the internet to compare prices
when your insurance for the following becomes due?" loop
{
use InsuranceType
} fields (
WillUseInternet "WillUseInternet" categorical [1..1]
{Yes, No};
) column expand;
and the output would be:
When a loop contains more than one question, all questions for a repetition are displayed one below the other on the same page. When the respondent clicks Next to continue, the interviewing program displays a new page containing all the questions for the second iteration. See Asking repeated questions for information on how to display each question on a separate page.
See also
Repeated questions