A derived variable is made from other variables by a rule. The rule is kept and the values are worked out from the responses each time, so a response that arrives tomorrow is included without doing anything. A derived variable appears in frequencies, cross-tabs, every test and the SPSS, Stata and CSV exports, with its labels. The codebook gives its rule.
Make one
- Open the study, then Collect, then Survey Builder, and choose the Dictionary tab.
- Choose New derived variable.
- Under Rule, choose what you are making. The four rules are below.
- Give it a Name (letters, digits and underscores, starting with a letter), a Label, and a Measure.
- Choose Save and check the values. The dialog shows how many responses took each value, and how many have none. Check it before you analyse anything.
The new variable appears at the end of the dictionary, marked derived, with its rule in words. Open it to Edit the rule or Delete it.
The four rules
Recode into new codes. Choose the variable under Recode which variable, then type a New code beside each old answer you want to keep. Old answers given the same new code are grouped. Label each new code under Labels of the new codes. Under Any other answer, choose Is missing or Is copied unchanged. A code declared missing, such as "Refused", is carried into the new variable only if you give it a new code. A county, ward or collection channel can be recoded too, for example counties into regions.
Bands from a number. Choose the variable under Band which number, then add a row for each band with its From, To, Code and Label. Both ends are included, and a value goes to the first band it fits. Leave From empty for "and under" or To empty for "and over". A label left empty is written from the range, such as 18–34. A missing code, such as an age of 999 for refused, is never put in a band.
Compute from others. Write the expression as a questionnaire's calculations are written: ${q1} + ${q2}, round(${income} div 1000, 1) or if(${age} >= 18, 1, 0). Insert a variable adds a name for you. Each variable is read as a number, and a missing answer anywhere in the expression gives no value. Expressions that read today's date are refused, because the value would change every day.
Count of a multiple choice. Choose the question under A multiple choice, and the count is how many of its options each person chose. To count across other variables, choose them under Or these variables and list the Codes counted. Someone with every one of them missing has no count, rather than a count of nought.
When a rule stops working
A variable a derived variable reads cannot be renamed or deleted while the rule uses it; the dictionary says which derived variable to change first. If the questionnaire changes and a variable the rule reads disappears, the derived variable says so in the dictionary and has no values until its rule is edited.