Data editing > Data-mapped variables > Additional features using data-mapped variables
 
Additional features using data-mapped variables
The following features provide you with further flexibility:
Using the AND, OR and XOR functions directly
You can use the AND, OR and XOR functions to combine the values of several categorical data-mapped variables. As well as assigning the result to another variable, Quantum also allows the value to be tested directly. Using the & and = operators, you can test for response texts in the result of these functions. For example:
if ( or(q25,q26) $Coffee\$ ) ....
n01Purchased fridge on both occasions;c=and(q25,q26)$fridge$
r ( .not. xor(q17,q18) $_other$ ) $Other mentioned only once$
This is a useful feature in that if two or more tests are to be performed on the same operation, then it may be better to assign the result to a new variable and test that. This saves you repeating the AND, OR or XOR operation many times.
Counting responses with the numb function
Sometimes, you need to know the number of responses to a categorical question (for example, to calculate the average number of mentions). You can use the numb function to count the number of precoded categories that are set in one or more data-mapped variables. Similarly to AND, OR and XOR, the numb function is given a comma-separated list of data-mapped variables to act upon. The function returns a count of the number of precoded responses set on all of the given variables. This can be used in the usual way.
For example:
t1 = numb(q25, q26)
n01Average number of purchases;inc=numb(q23)
flt ;c=numb(q23).gt.1
numb counts only precoded responses. This means that it will include all user-defined responses and also the $_other$ response; it does not include the $_dk$, $_ref$, $_na$ or $_null$ responses.
See also
Data-mapped variables