The mark as tag or decorator 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; text: Marked as Female}
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)} {text: Marked as not Working}Tip! If you need to create a variable for open-end options, see create closed.
Details
-
mark asis only for use with closed-end options. - The
mark astag requires an input of a variable name followed by a condition. - The
mark asdecorator 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." - Optionally,
textcan be included to adjust the description of the variable from the default. - Optionally,
report placementcan be included to adjust the location of the variable in the reporting field tree. - Multiple
mark astags 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 astag 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 as: YOUNGER_MAN_S3 {if anyChecked($QS3,1) and $QS2 <= 30}
mark as: 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)}
Changing the report placement
In some cases, it may make sense to change the placement of the marked variables. This can be done by using report placement as shown below. In this example, MALE_QS1 will found in the reporting field tree after QS2 and QWORKING_QS2 will be located before QS1.
S1. What is your gender?
type: radio
1. Male {mark as: MALE_QS1; text: Marked as Male at QS1; report placement: after QS2}
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)} {text: Marked as Working at QS2 } {report placement: before QS1}
Referencing marked variables
Marked variables can be referenced in condition logic later in a survey by adding a '$' in front of them. The show if logic for QS4 and QS5 is simplified 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 as: YOUNGER_MAN_S3 {if anyChecked($QS3,1) and $QS2 <= 30 }
mark as: OLDER_MAN_S3 {if anyChecked($QS3,1) and $QS2 >= 65}
S4. Are you currently retired?
type: radio
show if: $OLDER_MAN_S3
1. Yes
2. Not yet
S5C. Do you currently have any student loans?
type: radio
show if: $YOUNGER_MAN_S3
1. I never had student loans.
2. I've paid them off!
3. Sadly I still have student loans.
You can also condition logic based on a marked variable not being marked by using the not syntax. In the example below, Q1B will be asked of all those who are not marked as a DELIVER_USER.
1A. In which of the following ways have you ordered from any fast food / quick service restaurant in the <b><u>past 6 months</b></u>?
class: std_checkbox_question
randomize: y
1. Delivery
2. Carry Out
3. Dine-In
4. Drive-Thru
5. Curbside
6. Catering
mark as: DELIVER_USER {if anyChecked($Q1A,1)}
1B. Have you recently considered using delivery?
type: radio
show if: not($DELIVER_USER)
1. Yes
2. No
Comments
0 comments
Please sign in to leave a comment.