Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Logical expressions > Checking categorical responses > A given number of specified responses chosen
A given number of specified responses chosen
To test whether the respondent chose a given number of answers from a set of responses, as in, did the respondent choose three track and field sports from a selection of sports, use the ContainsSome function.
ContainsSome({Resp1, Resp2, ... Respn}[, Minimum][, Maximum][, No_Others])
The name of the question whose response you want to check.
Resp1 to Respn
The names of the responses you want to check for.
The minimum number of responses that must be chosen from the set in order for ContainsSome to be True. If you omit this parameter, the default is zero meaning that none of the specified responses need be chosen.
The maximum number of responses that must be chosen from the set in order for ContainsSome to be True. If you omit this parameter, the default is the number of responses specified in the expression.
No_Others is True if the response can contain only answers from the specified set, or False if other answers can be chosen too. The default is False.See ContainsSome for more information.
If the Sports question is defined in the Metadata section as:
Sports "Which sports do you take part in?" categorical [1..]
  Running, Cycling, Football, Javelin, Discus,
  HighJump "High jump", LongJump "Long jump",
  Swimming, Basketball, Tennis, Hockey, Rugby,
  PoleVault "Pole vault", Netball, Gymnastics
and you want to test whether the respondent’s answer contains between three and five track and field events, you would write the following expression:
    PoleVault}, 3, 5)
This expression ignores any other sports that might be present in the response to the Sports question, and has the same effect as:
    PoleVault}, 3, 5, false)
If you want to take other sports into account and test whether the respondent mentioned only three, four, or five track and field events and no other sports, you would write:
    PoleVault}, 3, 5, true)
You can leave the minimum and/or maximum number of required responses undefined, and the interviewing program will use the function’s default settings instead. The default minimum is one, so the expression:
    PoleVault}, 5)
is True if the respondent’s answer contains between one and five of the specified sports. It is False if all six sports or none are mentioned. The results of the expression are unaffected by any other sports mentioned.
Similarly, if the expression is:
    PoleVault}, 3)
the result is True if the respondent mentions at least three of the specified sports, regardless of any other sports mentioned.
See also
Checking categorical responses