Professional > Data management scripting > Data Management reference > Data Management functions > SumQuestions
 
SumQuestions
Sums the value for more than one categorical question (used for OnNextCase events).
Syntax
SumQuestions(TotalCat, CatVar1, CatVar2, CarVar3,,,)
Parameters
CatVar1
Type: object
Categorical question. The number of questions varies, but there should be at least two questions.
CatVar2
Type: object
Categorical question. The number of questions varies, but there should be at least two questions.
TotalCat
Type: object
Categorical question. TotalCat.response.value=
catVar1.response.value + catvar2.response.value
(return)
Type: Categorical
TotalCat.Response.Value
Notes
The question TotalCat will sum the response.value of questions CatVar1, CatVar2, to CatVarN. If there is only one question, TotalCat will have the same value as CatVar1.
There are restrictions when using this function:
All questions must be categorical.
Questions can contain special responses, such as DK / NA/ REF, but the questions will be adjusted to the related special response for CatVar1.
Example
SumQuestions(TotalSum4, Spont, Prompt1, Prompt2, Prompt3)
The definitions for TotalSum4, Spont, Prompt1, Prompt2, and Prompt3 are as follows:
TotalSum4 "What animal you like? (Do not read the list)"
categorical [1..]
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
snake "snake",
SpontDK "SpontDK" DK,
SpontREF "SpontREF" REF,
SpontNA "SpontNA" NA
};



Spont "What animal you like? (Do not read the list)" categorical [1..]
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
snake "snake",
SpontDK "SpontDK" DK,
SpontREF "SpontREF" REF,
SpontNA "SpontNA" NA
};

Prompt1 "What animal you like? (read the list)" categorical [1..]
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
snake "snake",
Prompt1DK "SpontDK" DK,
Prompt1REF "SpontREF" REF,
Prompt1NA "SpontNA" NA
};

Prompt2 "What animal you like? (read the list)" categorical [1..]
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
snake "snake",
Prompt2DK "SpontDK" DK,
Prompt2REF "SpontREF" REF,
Prompt2NA "SpontNA" NA
};

Prompt3 "What animal you like? (read the list)" categorical [1..]
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
snake "snake",
Prompt3DK "SpontDK" DK,
Prompt3REF "SpontREF" REF,
Prompt3NA "SpontNA" NA
};
The related values are as follows:
Question
Case 1
Case 2
Spont
{ spontDK}
{Giraffe}
Prompt1
{Prompt1DK }
{Prompt1NA}
Prompt2
{ Giraffe }
{Prompt2DK}
Prompt3
{Prompt3NA}
{Giraffe}
TotalSum4
{ Giraffe,SpontNA ,spontDK}
{Giraffe,SpontNA,SpontDK}
See also
Data Management functions