Survey Tabulation > Advanced expressions > Operators > Complex expressions
 
Complex expressions
You can create complex expressions using more than one operator, when necessary using parentheses () to override the default order of precedence.
Examples
1. Numeric variables
(adults * (visits + visits12)) > 10
adults, visits, and visits12 are all numeric (Long) variables. This example adds the values in the visits and visits12 variables, multiplies the result by the value in the adults variable, and then tests whether the result is greater than 10.
2. Categorical variables.
(why_decid + desc_leave) <= {TO_BRING_CHILDREN, PLACE_TO_BRING_CHILDRENFAMILY}
why_decid and desc_leave are single response (Categorical) variables. This expression performs a union of the categories selected in the two variables and tests whether the resulting list contains one or two child-related categories only.
3. Categorical and numeric variables.
(gender = {FEMALE}) And
(((dinosaurs + human + mammals + species + whales) / 5) > 3))
dinosaurs, human, mammals, species, and whales are all numeric (Long) variables that record the rating, on a scale of 1-5, that respondents gave to five different galleries. This example selects female respondents, adds the ratings for the five galleries and divides the result by 5, and then tests whether the result is greater than 3. This expression therefore selects female respondents who gave the five galleries an average rating of more than 3.
See also
Operators