Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Logical expressions > Checking for special responses to non-categorical questions
Checking for special responses to non-categorical questions
If a numeric or text response list contains a codes() section that allows the special responses na, dk and ref you might want to check whether the respondent chose one of these responses rather than entering a number or text.
Qname.Response.Coded CategoricalTest
The name of the question.
Any valid syntax for testing categorical responses.
If Age is defined as:
Age "How old will you be next birthday?" long [18 .. 99]
codes (
AgeRef "Would rather not say" ref,
AgeDK "Don't know/Can't remember" dk
the expression:
Age.Response.Coded = {AgeDK}
tests whether the respondent chose Don't know.
In this example only one of the coded responses can be chosen, but sometimes this is not the case. When more than one coded response can be chosen, use an expression such as:
Notice how ContainsAny is appended to the rest of the expression, as it would be for an ordinary categorical question.
See also
Logical expressions