Tables and axes > More about axes > val statement > Combining arithmetic equality and range testing
 
Combining arithmetic equality and range testing
The operators =, I and R can be combined in one val statement, as follows:
l hshld
val c(110,111);Base;hd=Size of Household;=;1 Person;2 People;
+I;3-4 People;5-6 People;7-8 People;9 or More People
Note If you combine an i or r operator with elements that specify a single value only, Quantum reads those values as open-ended ranges. For example, if you write:
val c120;i;Male=1;Female=2
Quantum increments the count for Male every time it finds a value of 1 or greater in c120, and the count for Female every time it finds a value of 2 or greater. To correct this example you would replace the i operator with the = operator.
A full range must be defined to obtain a correct calculation. For example, the statement:
l age
val c(101,102);i;Under 29 years;30-40;41 or over
gives an incorrect value. This is because “Under 29” is interpreted to mean anyone between 29 and 99 years, and “41 or over” also matches anyone over 41. The Under 29 element should be redefined as a range; for example:
val c(101,102);i;Under 29 years=18-29;30-40;41 or over
See also
val statement