A computed question is not asked; instead, its value or response is computed from a formula which uses other questions, constants and system variables. Its value is intended for later use. Its possible applications are:
An argument in a later skip condition.
Insertion in the long label of a later question (using < >).
Data to be written to some external data file (.TXT or .ADM).
Selection of a choice in the computed question itself. This choice may then contribute to quota fulfillment, choice elimination, or recalls.
You create a computed question exactly as you do a regular question, however you specify an IF Condition for a complex skip whose destination must be an asterisk (*), which means: skip to next question in any case. You then enter a computation formula rather than a skip condition, the syntax rules of which are the same.
Example 1
Suppose that we have the following two questions, Q23A and Q23B, asking for the quantity and frequency of consumption of some XYZ product:
Q23A: |
How much XYZ do you drink ? |
mask: |
$E |
choice: |
99 skip to +3 Refusal |
|
|
Q23B: |
Note the frequency |
choices: |
01 Daily |
|
02 Weekly |
|
03 Monthly |
|
04 Yearly |
Suppose now that we would like to express the combined response to these two questions in terms of annual consumption. We create question Q23C and perform the calculation:
Q23C: |
Yearly consumption of product XYZ |
skip to * |
|
if |
Q23A * PRJ (Q23B, 365, 52, 12, 1) |
A computed question which does not have response choices can only have a value. However, if it does have response choices, the system will look for a match between its computed value and one of its own response choices. If a response code matches the computed value, it will be selected.
Example 2
In the following computed question, one of its response choices will be picked dependent on a computation involving a previous question:
Q3: |
Frequency of visits |
|
mask: |
$E |
|
skip to * if |
IF((NOT Q2 = WR), MIN (3,Q2), 99) |
|
no |
Code |
label |
1 |
01 |
Once |
2 |
02 |
Twice |
3 |
03 |
Often |
4 |
99 |
Don't know |
If there was a coded response to Q2, then Q3 will take a value of 3 or less, and the corresponding code will be picked. If there was no response to Q2, then Q3 will take a value of 99, and the code 99 will be picked.
Important:
In order to be able to dump the value of a computed question to an external file, or to display it in a long label (between < >), the Maximum number of responses attribute must be at least 1, and the Code width must be sufficient. To specify a desired number of decimal places, use the $R.nn mask.
Computed questions have a value of 0 until the interview reaches them, at which point they are actually computed.