Data editing > Data-mapped variables > Testing the value of a data-mapped variable > Test the categoric response
 
Test the categoric response
You can test any data-mapped variable to see if it holds a specific categorical response text in the following ways:
To test if a data-mapped variable has only one categorical response, and it is the one specified, you can use the = operator.
To test if a data-mapped variable has one or more categorical response stored, including the one specified, you can use the & operator.
Testing for categorical response texts is achieved by specifying the variable name, the test operator and the response text. The syntax is very similar to the way the presence of response punch codes are tested when using standard data variables. However, it is not possible to test for the presence of several response texts in a single test. The following examples show how you might check for responses using standard data variables with punch codes, and using data-mapped variables with response texts:
Standard data variables
Mapped data variables
c123'1'
q23$Yes$
c146n'7'
q46n$I liked the taste$
c109='7'
q9=$Portable CD Player$
c127'34'
q27 $Yesterday$.or.q27$Today$
In the same way as using standard variables, you can omit the test operator, in which case & is assumed. You can also combine or negate tests using the logical operators: .or, .and., and .not. and adjust the order of evaluation using parentheses.
In addition to using just the response texts associated with a given variable, you can also:
Use one of the special response texts: that is, one of $_base$, $_normal$, $_dk$, $_ref$, $_other$, $_na$, $_null$, $_precode$, $_special$, $_answered$ and $_possible$.
Use the unique ID associated with a response using the syntax $_(unique_ID)$.
If you have specified the unique ID on an element (using uniqid=keyword), then you can use the special response text $_uniqid$ as a shorthand for $_(unique_ID)$.
You can specify only as much of the response text as is needed to uniquely identify it. When doing so, you must append a \ character to the text. For example, $Very impressed$ may become $Very\$ and $Quite impressed$ may become $Quite\$ (or, in fact, just $V\$ and $Q\$ if these strings are unique).
You can also specify response texts (or the unique ID) using either uppercase, lowercase characters, or any such combination.
See also
Testing the value of a data-mapped variable