The mark as
tag or decorator (alias mark
) can be used to create a variable that records the options selected when a condition is met.
S1. What is your gender?
type: radio
1. Male {mark as: MALE_QS1}
2. Female {mark as: FEMALE_QS1}
91. Other
98. Rather not say
S2. What is your current employment status?
type: radio
1. Full-time employed (30+ hrs./wk.)
2. Part-time employed
3. Self-employed
4. Retired
5. Full-time student
6. Unemployed
mark as: QWORKING_QS2 {if anyChecked($QS2,1..3)}
mark as: QNOTWORKING_QS2 {if anyChecked($QS2,4..6)}
Tip! If you need to create a variable for open-end options, see create closed.
Details
-
mark as
is only for use with closed-end options. - The
mark as
tag requires an input of a variable name followed by a condition. - The
mark as
decorator can be added after the option text and requires an input of a variable name. No condition is required since selecting the option triggers the "condition." - Multiple
mark as
tags can be included on a single widget. - Multiple options can qualify for a single variable, and options can qualify for multiple marked variables.
- If the conditional statement references multiple questions or variables, the
mark as
tag is placed on the final widget needed to qualify the variable. - To reference a marked variable in downstream logic, add a '$' in front of the variable name.
Note: Marked variable labels do not include a leading 'Q' by default. If a leading 'Q' is desired, include it in the assigned variable name, e.g. mark as: QYOUNG
.
Marked variables and reporting
Marked variables are assigned a '1' ("Marked") if a respondent punches the variable and a '0' ("Not marked") if not.
These variables are stored in two locations in the reporting field tree. First, a summary variable, 'mark', is created under the Survey fields chapter. A Markers folder is also created under System fields, where each individual marked variable can be found.
Additional examples
Defining marked variables with multi-part conditions
Marked variables can be created with multi-part (compound) conditions, using responses from two or more questions. In this example, respondents may qualify for either of the marked variables based on the age inputted in QS2 and if they selected 'Male' in QS3.
S2. What is your age?
type: number
datatype: whole
range: 18-110
S3. What is your gender?
type: radio
1. Male
2. Female
91. Other
98. Rather not say
mark: YOUNGER_MAN_S3 {if anyChecked($QS3,1) and $QS2 <= 30}
mark: OLDER_MAN_S3 {if anyChecked($QS3,1) and $QS2 >= 65}
Qualifying for multiple marked variables
In some cases, it may be necessary for options to qualify for multiple marked variables. In Q4, it is possible for a car company to punch either the FOR_CAR or US_CAR variables, while also punching the LUXURY_CARS variable.
4. Which auto companies do you sell at your dealership?
type: checkbox
randomize: y
1. Toyota {mark as: FOR_CAR}
2. Mercedes {mark as: FOR_CAR}
3. Audi {mark as: FOR_CAR}
4. Ford {mark as: US_CAR}
5. Kia {mark as: FOR_CAR}
6. BMW {mark as: FOR_CAR}
7. Lexus {mark as: FOR_CAR}
8. Chevrolet {mark as: US_CAR}
9. Dodge {mark as: US_CAR}
10. Cadillac {mark as: US_CAR}
mark as: LUXURY_CARS {if anyChecked($Q4,2,3,6,7,10)}
Referencing marked variables
Marked variables can be referenced in condition logic later in a survey by adding a '$' in front of them. Building off our previous example, we can simplify the showif
logic for QS4 and QS5 by referencing the marked variables YOUNGER_MAN_S3 and OLDER_MAN_S3.
Note that a leading 'Q' is not necessary to reference the marked variables.
S2. What is your age?
type: number
datatype: whole
range: 18-115
S3. What is your gender?
type: radio
1. Male
2. Female
91. Other
98. Rather not say
mark: YOUNGER_MAN_S3 {if anyChecked($QS3,1) and $QS2 <= 30 }
mark: OLDER_MAN_S3 {if anyChecked($QS3,1) and $QS2 >= 65}
S4. Are you currently retired?
type: radio
showif: $OLDER_MAN_S3
1. Yes
2. Not yet
S5C. Do you currently have any student loans?
type: radio
showif: $YOUNGER_MAN_S3
1. I never had student loans.
2. I've paid them off!
3. Sadly I still have student loans.
Comments
0 comments
Please sign in to leave a comment.