UCL Logo
Page tree
Skip to end of metadata
Go to start of metadata

Key Considerations

  • Loops are used for repetitive questions.
  • Loops are also used when grids have no over-arching question texts.

The term ‘loop’ is used to describe a series of actions that are completed over and over until a certain condition becomes true.

“Place once slice of bread buttered side up, then add lettuce, two slices of cheese, and top with another slice of buttered bread, face down. Repeat this until you have four sandwiches.”

In DDI 3.2, a Loop is useful when describing a series of repeating questions. They can include all types of constructs, including question grids, conditions, sequences and even other loops. The limit to how many times the question is repeated per instance is set by a logic (a mathematical representation of a decision point, where different choices route the participant different ways). This logic either draws on a source outside of the loop, such as a previous question, or it is stated directly within the loop itself. This is explained in further detail with the two examples below.

A loop can be an efficient way of condensing a repeating question set in a way that makes the material easier to read whilst not losing the original function.

When naming loops, you use the first construct that exists in the series of constructs (usually a question) that the loop describes. See Example 1 - Archivist Build and the Construct a Label page for an overall guide on labelling.

Example 1 Questionnaire: ALSPAC Study Mother's Questionnaire

When a loop relies on the answer to a previous question, such as how many times something has occurred, the logic used to generate the loop references the question.

Questionnaire layout:

Archivist Build / Constructs (alspac_96_smq):

Archivist view (alspac_96_smq):


In the above example, the loop l_qA10c references question qc_A10_b in the first part of the logic to begin the loop cycle. This runs as many times as the number that the questionnaire respondent originally states for ‘How many times?’:

    _pregnancy from 1 while (_pregnancy <= qc_A10_b) && (_pregnancy < 7)

In the second part of the logic, the < 7 tells us that the cycle must not run more than 6 times, as there are only six spaces to record a pregnancy shown in the original document.

  _pregnancy from 1 while (_pregnancy <= qc_A10_b) && (_pregnancy < 7)

Example 2 Questionnaire: NSHD Study Member Self Completion 1965

Sometimes a loop is used where we cannot use a Question Grid, because the group of questions has no overarching text - an essential part of a question grid. In this example a start and and end value has been added, as there is a limited number of rows which can be completed, the Loop While option is not needed in this case. Currently the Archivist view converts the Start Value and End value into logic incorrectly, in this example the logic should be   _children from 1 while _children <= 3. 

Questionnaire layout:

Archivist Build / Constructs:

Archivist view (nshd_65_smsc):


  • No labels