To specify
|
Syntax
|
---|---|
A range of values
|
Field loop [ n1 .. n2 ]
|
|
Example:
Visits loop [1..10]
|
|
The loop repeats 10 times (once for each value in the range).
|
several different ranges
|
Field loop [ n1 .. n2 , n3 .. n4 , n5 .. n6 ...]
|
|
Example:
Rate loop [24..56, 100..1000]
|
|
The loop repeats 934 times (once for each number within each range).
|
single values
(Not supported in Data Model 2.8.)
|
Field loop [ n1 , n2 , n3 , n4 ...]
|
|
Example:
Sizes loop [100, 200, 500]
|
|
The loop repeats three times (once for each value that is specified).
|
a minimum to undefined maximum
|
Field loop [ n1 ..]
|
|
Example:
People loop [1..]
|
|
The number of times the loop repeats is undefined and will be decided when each interview takes place. This is sometimes called an unbounded loop. For example, in a household survey, the loop will be repeated once for each person in the household. However, this loop definition is supported only when the data is being stored hierarchically and you cannot use the expand keyword on a loop that has an undefined maximum number of iterations.
|
from undefined minimum to maximum
|
Field loop [.. n1 ]
|
|
Example:
Cars loop [..10]
|
|
The loop repeats up to ten times, depending on the start value, which will be decided when each interview takes place.
|
exclusive values
|
Field loop [^ n1 .. n2 ]
|
|
Example:
Grade loop [1..10, ^5..7]
|
|
The loop repeats 7 times, once for each whole number between 1 and 10 inclusive, except the whole numbers between 5 and 7 inclusive (that is, 1, 2, 3, 4, 8, 9, 10).
|
stepped values
|
Field loop [ n1 .. n2 step n3 ]
|
|
Example:
mount loop [0..100 step 10]
|
|
The loop repeats 11 times, once for all whole numbers between 0 and 100 inclusive in steps of 10 (that is, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.)
|