The list of operators can be used in the following way:
AND, OR
Can be used in categorical computes to combine variables or parts of your expression. For example:
- ∅11-Satisfaction=('1 - 1 Not at all satisfied,2 - 2')∅ AND ∅31-Contact=('1 - I like to be contacted')∅
This expression for answer code 1 will result in:
Respondent | Satisfaction | Contact | New variable |
1 | 3 | 1 | |
2 | 2 | 0 | |
3 | 1 | 1 | 1 |
4 | 5 | 0 |
- ∅11-Satisfaction=('1 - 1 Not at all satisfied,2 - 2')∅ OR ∅31-Contact=('1 - I like to be contacted')∅
This expression for answer code 1 will result in:
Respondent | Satisfaction | Contact | New variable |
1 | 3 | 1 | 1 |
2 | 2 | 0 | 1 |
3 | 1 | 1 | 1 |
4 | 5 | 0 |
NOT
Can be used in categorical computes to exclude answer alternatives from your expression for answer 1.
- ∅5-Gender=('1 - Man')∅ AND NOT ∅4-Age group=('1 - 15-24')∅
This expression for answer code 1 will result in:
Respondent | Gender | Age group | New variable |
1 | 1 | 1 | 1 |
2 | 2 | 2 | 1 |
3 | 1 | 3 | 1 |
4 | 2 | 4 |
NOT can be used to create a closing category "Other", but keep in mind the spaces (no space after ")" and after "NOT"):
- NOT(∀98-BRAND∀=('1 - brand 1'))AND NOT(∀98-BRAND∀=('2 - brand 2'))AND NOT(∀98-BRAND∀=('3 - brand 3'))AND NOT(∀98-BRAND∀=('4 - brand 4'))
LIKE
Can be used when computing categorical variables to find all respondents with a specific word or sentence in an open ended variable. Text should be enclosed inside double quotes, as seen in the example below.
- ∀98-What do you think the ad wants to tell you?∀ LIKE "brand name"
This expression for answer code 1 will result in:
Respondent | What do you think the brand wants to tell you | New variable |
1 | To buy more | |
2 | To remember the brand name | 1 |
3 | To remember it | |
4 | To buy |
Mathematical operands (+, -, *, /)
Can be used to create an open numeric compute in which you make calculations with your open numeric variables.
- †98-Open numeric Value 1† + †99-Open numeric Value 2†
This expression will result in:
Respondent | Open numeric Value 1 | Open numeric Value 2 | New variable |
1 | 1 | 1 | 2 |
2 | 2 | 2 | 4 |
3 | 1 | 3 | 4 |
4 | 2 | 4 | 6 |
Mathematical symbols (=, >, <)
Can be used when computing categorical variables to find respondents with values equal, above or below a specified limit in a numeric variable. Can also be used together with a date variable to find all respondents from, before or after a specific date.
- (†98-Open numeric†>3) AND (♮1100000000001-Response Date♮>"2017-19-10")
Dates need to be surrounded by either double quotation marks (“) or brackets when used in an expression. Accepted formats are for example “YYYY-DD-MM” and (MM/DD/YYYY).
This expression for answer code 1 will result in:
Respondent | Open numeric | Response Date | New variable |
1 | 1 | 2017-18-10 | |
2 | 4 | 2017-20-10 | 1 |
3 | 3 | 2017-21-10 | |
4 | 4 | 2017-21-10 | 1 |
COUNTRESPONSE
This can be used to create a categorized variable or open numeric, but always needs a categorized variable as input in the expression (the option doesn't even appear if you have open numeric selected as your input.
You can count number of respondents, all respondents that qualify to statement get value one.
- COUNTRESPONSE (∅51-Country=('1 - Sweden')∅)
This expression will result in:
Respondent | Country | New variable |
1 | 1 | 1 |
2 | 2 | |
3 | 2 | |
4 | 1 | 1 |
IF
Can be used to create an open numeric together with for example the function COUNTRESPONSE and Mathematical symbols to create a numeric variable based on a categorical variable. The example below shows one use of the function where respondents aware of more than 4 brands are given the value 1, all other get value 0.
- IF (COUNTRESPONSE (∅8-Spontaneous brand awareness - In mind=('1 - Dapresy Telecom,2 - Four,3 - Swedish Telecom,4 - Sweet Talk,5 - Telecom for You,6 - Duty Calls,7 - Tel Me More,8 - DonkyCom,9 - WTC,10 - Donut Call')∅) > 4, 1, 0)
Respondent | Spontaneous brand awareness - In mind (multiple) | New variable (more than 4 brands mentioned) |
1 | 1,2,3,4,5,7 | 1 |
2 | 3,4,6 | 0 |
3 | 2,4,5,6,7 | 1 |
4 | 2,4,5,6,7,8,9 | 1 |
You can use the IF statement too to recode a categorical question into an open numeric with two answers, for example:
- IF( COUNTRESPONSE(∅19-Allows us to keep name together with results=('2 - No')∅)=1,7,3
This counts any respondent who has a response for "No" in "consent" question and gives that a value of 7. Everything else gets 3
Respondent | Allows us to keep name together with results | New variable |
1 | 1 | 3 |
2 | 2 | 7 |
3 | 1 | 3 |
4 | 2 | 7 |
COUNT
Aggregate calculation including all respondents:
Give your computed numeric variable the number of respondents that have answered one or several answer alternatives in a categorical question. Optional if calculations should be made on weighted or non-weighted data.
- COUNT (∅1-Country holiday=('4 - Denmark,5 - Finland')∅)
Respondent | Country holiday | New variable |
1 | 1,2 | 3 |
2 | 3,2,4 | 3 |
3 | 1 | 3 |
4 | 4,5 | 3 |
MEAN
Aggregate calculation including all respondents:
Use in a computed numeric variable to derive the mean of a categorical variable. Optional if calculations should be made on weighted or non-weighted data.
- MEAN (∅31-Market leader=('1 - 1 Don't agree,2 - 2,3 - 3,4 - 4,5 - 5 Agree completely')∅
Respondent | Market leader | New variable |
1 | 3 | 2,75 |
2 | 2 | 2,75 |
3 | 1 | 2,75 |
4 | 5 | 2,75 |
PERCENT
Aggregate calculation including all respondents:
Use in a computed numeric variable to derive the percentage of one or several answers in a categorical variable. Optional if calculations should be made on weighted or non-weighted data.
- PERCENT (∅5-Gender=('2 - Woman')∅)
Respondent | Satisfaction | New variable |
1 | 1 | 75% |
2 | 2 | 75% |
3 | 2 | 75% |
4 | 2 | 75% |
VALUE
This function makes it possible to convert a single choice categorical variable into a numeric variable. Each answer alternative gets the value of its factor. The IDs of the answers are not used. For example, a variable with IDs 1-5 and factors 0, 25, 50, 75, and 100 will for respondents who answered alternative 3 get the numeric value 50.
NOTE: VALUE function should be applied only to single choice categorical variables. Using it for multi choice categorical variables the respondents might get several values assigned to them, which will affect any numeric calculations performed.
The expression below shows an example where a single choice scale question is converted to a numeric variable.
- VALUE (∅45-Purchase intention=('1 - 1 Not at all likely,2 - 2,3 - 3,4 - 4,5 - 5 Very likely')∅)
Respondent | Satisfaction | New variable |
1 | 1 | 0 |
2 | 3 | 50 |
3 | 5 | 100 |
4 | 2 | 25 |
The question in this example also has an answer “Don’t know” that’s excluded from the expression. All respondents with that answer will get a missing value in the new computed variable. If you prefer to insert a 0 instead of a missing value for excluded respondents, then the additional setting “Treat missing answer as 0” can be used.
NOTE: all respondents excluded from the expression will get value 0, no matter if it’s because they answered an excluded answer or haven’t answered the question at all.
If you use several VALUE functions in your expression a respondent will get missing value in case any of the included functions result in a missing value for that respondent. The example below shows how the difference between two scale questions can be calculated.
- (VALUE (∅14-Performance - Quality1=('1 – 1Not at all important,2 - 2,3 - 3,4 - 4,5 - 5 Very important')∅)) - (VALUE (∅15-Importance - Quality2=('1 – 1Not at all important,2 - 2,3 - 3,4 - 4,5 - 5 Very important')∅))
Following this example let’s say respondent X answered 2 on the Performance question, but did not answer the Importance question. The value for this respondent then becomes:
- 5 - Missing value = Missing value
Respondent | Performance - Quality1 | Importance - Quality2 | New variable |
1 | 1 | 2 | -25 |
2 | 3 | 3 | 0 |
3 | 5 | 1 | 75 |
4 | 2 | Missing |
Or if setting “Treat missing answer as 0” is applied:
- 5 – 0 = 0
Respondent | Performance - Quality1 | Importance - Quality2 | New variable |
1 | 1 | 2 | -25 |
2 | 3 | 3 | 0 |
3 | 5 | 1 | 75 |
4 | 2 | 0 |
The letters around each variable in the expression, like ∅, ∀, ∫ and ♮, are there for the system to separate the variable types from each other.
YEAR, MONTH, DAY
Use when computing a categorical variable together with a date variable to find all respondents from a specific year, month or day.
- (♮1100000000001-Response Date♮ YEAR=2017) AND (♮1100000000001-Response Date♮ MONTH=5)
Respondent | Response Date | New variable |
1 | 12-05-2017 | 1 |
2 | 12-12-2017 | |
3 | 12-11-2017 | |
4 | 10-05-2017 | 1 |
If you need to have a variable called YEAR, you can create a categorical variable, with the years as answer categories and use this expression:
Answer 1 2016: ♮1100000000001-Response Date♮ YEAR=2016
Answer 2 2017: ♮1100000000001-Response Date♮ YEAR=2017
Answer 3 2018: ♮1100000000001-Response Date♮ YEAR=2018
Respondent | Response Date | New variable |
1 | 12-05-2017 | 2 (2017) |
2 | 12-12-2017 | 1 (2016) |
3 | 12-11-2017 | 2 (2017) |
4 | 10-05-2017 | 3 (2018) |
An alternative way of doing this is using the YEAR function. You create an open numeric first and add the expression:
YEAR (♮1100000000001-Response Date♮)
Respondent | Response Date | New variable |
1 | 12-05-2017 | 2017 |
2 | 12-12-2017 | 2016 |
3 | 12-11-2017 | 2017 |
4 | 10-05-2017 | 2018 |
In the same way you can use MONTH or DAY. For example the expression:
MONTH (♮1100000000001-Response Date♮)
Respondent | Response Date | New variable |
1 | 12-05-2017 | 5 |
2 | 12-12-2017 | 12 |
3 | 12-11-2017 | 11 |
4 | 10-05-2017 | 5 |
#CurrentDate#
Can be used when computing categorical variables to replace a fixed date. The current date is updated during data activation, when computed variables are being saved/updated and can be updated daily at 00:00 automatically if this option is selected. Current date is preferably used in projects that are being updated daily to get full utility of the function. It can be inserted together with (+) and (-) operands to count days back and forward.
Example of expressions:
- ♮1100000000001-Response Date♮="#CurrentDate#"
- ♮1100000000001-Response Date♮<"#CurrentDate#"
- ♮1100000000001-Response Date♮<"#CurrentDate#-7"
If current day is 2017-10-19, the examples above should contain the following data:
- All respondents with response date equal to 2017-10-19
- All respondents with response date before 2017-10-19
- All respondents with response date before 2017-10-12
Just like standard dates the #CurrentDate# function need to be surrounded by double quotation marks (“) or brackets.
When deriving new date variables you can include other date variables, a fixed value or use a Numeric variable in the expression. If the data, for example, looks like the table below and the expression is Date+Qnum the date of the first respondent below would be 2019-10-12
Here we see an example of a real expression.
Subtracting dates
- "#CurrentDate#" - ♮1100000000001-Response Date♮The date variable can be any date variable in the project.
Dates in general
"Dates need to be surrounded by either double quotation marks (“) or brackets when used in an expression. Accepted formats are for example “YYYY-DD-MM” and (MM/DD/YYYY)." More examples of how time periods can be used can be found here.
Note: negative numbers can be used. Make sure you don't have quotes around them, as they are treated as normal single response answers.