Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Keywords for data analysis > Incrementing cell counts by the value of a numeric variable
Incrementing cell counts by the value of a numeric variable
When you create tables from your interview data, most cells in the tables are counts of people and cells are incremented by 1 for every respondent who belongs in them. You can also increment cells using the value of a numeric variable. For example, if you have an age question that places respondents in age groups, and a numeric question that asks how many portions of fruit each respondent ate, you can create a variable that shows how many fruit portions were eaten by each age group rather than the number of people in each group. Each time a respondent is counted in an age group, the count for that group is incremented by the number of fruit portions that person ate rather than by 1.
The numeric variable whose values you use to increment cell counts is sometimes called a multiplier because counts are incremented by 1 multiplied by the respondent’s value in the numeric variable.
To specify that you want to use a multiplier
multiplier (use Qname)
to the response definition, where Qname is the name of the numeric question that you want to use to increment the category counts in the current response.
Here are the question definitions for the age and fruit example. Age and Fruit are asked, but FruitByAge is a derived variable whose counts are incremented by the number of fruit portions eaten by respondents in each age group. See Additional variables for analysis only for further information about creating derived variables.
Age "How old are you?" categorical [1..1]
AgeU30 "Under 30",
Age3050 "30 - 50",
AgeO50 "Over 50"
Fruit "How many portions of fruit did you eat last week?" long [0..99];
FruitByAge "Fruit consumption by age group" categorical [1..1]
AgeU30 "Under 30 years old"
expression("Age={AgeU30}") multiplier (use Fruit),
Age3050 "30 - 50 years old"
expression("Age={Age3050}") multiplier (use Fruit),
AgeO50 "Over 50 years old"
expression("Age={AgeO50}") multiplier (use Fruit)
See also
Keywords for data analysis