Survey Tabulation > Advanced expressions > Operators > Arithmetic operators > + operator
 
+ operator
Double
Long
Text
Categorical
Date
Double
Add Double
Add Double
Add1 Double
Not applicable
Add1 Date
Long
Add Double
Add Long
Add1 Long
Union Categorical
Add2 Date
Text
Add1 Double
Add1 Double5
Concatenation Text
Union3 Categorical
Add4 Date
Categorical
Not applicable
Union Categorical
Union3 Categorical
Union Categorical
Not applicable
Date
Add2 Date
Add2 Date
Add4 Date
Not applicable
Add Date
Notes
1 Only if conversion from text to numeric is possible.
2 Operation occurs on the date’s double value representation. If the operation involves an invalid date, #### is returned.
3 Only if conversion from text to long or categorical is possible.
4 Only if conversion from text to date is possible.
5 If the text can be converted to a long without loss of precision, the result is a long.
Examples
1. Numeric variables
(visits + visits12) > 3
The visits12 and visits variables are numeric (Long) variables that record the number of visits that respondents have made to the museum in the previous 12 months and prior to that, respectively. The expression adds the values in the two variables and compares whether the result is greater than 3. For example, you could use this expression to create a filter to select respondents who have made a total of more than three previous visits to the museum.
2. Categorical variables
(remember + interest) >= {DINOSAURS}
The remember and interest variables are categorical variables that have similar category lists. The + operator performs a union of the two category lists and the >= operator tests whether the combined category list that results contains the Dinosaurs category. This means that you could use this expression to select respondents who chose the Dinosaurs category in response to either or both of the questions on which the variables are based.
3. Text variables
name + ": " + address
The name and address variables are text variables. This example uses two + operators to concatenate three text strings to form a single string containing the respondent's name and address separated by a colon and a space. For example, you could use this expression to create a "name and address" derived variable.
The above example shows how you would use the operator in mrScriptBasic or mrScriptMetadata. In an SQL query, you should enclose the text string in single quotation marks ' ' and not double quotation marks " ", like this:
name + ': ' + address
See also
Arithmetic operators