Groups are used to organize survey content such as questions, logic, and text. Content placed between a start group widget and its corresponding end group widget is grouped together.
1. Have you ever purchased groceries online?
type: radio
1. Yes
2. No
start group: PURCHASED
condition: anyChecked($Q1,1)
2. What prompted you to use the online option for buying groceries?
type: textbox
2A. Will you continue to purchase groceries this way?
type: radio
1. Yes
2. No
end group: PURCHASED
start group: NOT_PURCHASED
condition: anyChecked($Q1,2)
3. Why do you prefer to purchase groceries in the store?
type: textbox
3A. Is there anything that would make you try an online grocery purchase?
type: radio
1. Yes
2. No
end group: NOT_PURCHASED
Tip! If you are creating a group for a single question for the purpose of adding the condition tag, you can use the
show if tag on the individual question instead.
Details
- Tags on a
start groupwidget automatically apply to all questions and widgets within that group. - Groups are most commonly used to create skip patterns, but they can be used for other purposes as well, such as populating variables for use later on in the survey.
- The
start groupwidget can include aconditiontag to determine whether a respondent sees a specific set of questions, as shown above. - The
start groupwidget supports theorderandrandomizetags to organize the group's content. Useorderto set just the question order. Userandomizeto shuffle both the questions and their option sets. - The
start groupwidget supports theloop fortag to repeat the group's content.
Common tags
The following tags are commonly used with groups and are applied directly to the start group widget.
| Tag | Description |
chapter |
Places the group's contents in a chapter of the reporting field tree. |
condition |
Evaluates a conditional statement and shows/excludes group content if the logical statement is true. |
end group after(alias end after) |
Can be applied to the |
end group before(alias end before) |
Can be applied to the |
goto |
Routes respondents to another question, labeled group, or page. Note, the |
inline |
Controls page breaks within a group. Accepts 'y' and 'n' (default) inputs. |
loop for |
Repeats, or "loops," content within a group with slight variations in each iteration. |
order |
Specifies how to organize multiple questions in a group. |
Additional examples
Creating chapters
Groups can be used to create reporting chapters at the global level, automatically assigning all widgets within the group to the specified chapter. For example, applying the chapter tag to QS1 places it in Chapter A (Screener), while QD1 is included in Chapter B (Demographics).
define chapters
A. Screener
B. Demographics
start group: screener_group
chapter: A
S1. What is your age?
preface: This is the screener.
type: integer
datatype: whole
size: 3
range: <120
end group: screener_group
start group: demo_group
chapter: B
D1. What is your annual household income?
type: integer
datatype: whole
prefix: $
end group: demo_group
Using 'end group after'
You can also define a group using only the start group widget if you apply the end group after or end group before tag to the widget.
These tags specify either the last question in the group (end group after) or the first question outside the group (end group before). For example, if a respondent selects option '2. Girl' at Q6, they will proceed to questions Q7–Q9. The end group after tag indicates that the "for girls only" group concludes after Q9. Question Q10 will then be displayed to all respondents.
6. What is your child's gender?
type: radio
1. Boy
2. Girl
start group: girl_follow_up
condition: anyChecked($Q6,2)
end group after: Q9
7. How old is your daughter?
type: integer
range: 0-18
8. Does your daughter play with dolls?
type: radio
1. Yes
2. No
9. Has your daughter ever been to an American Girl store?
type: radio
1. Yes
2. No
10. New question shown to everyone.
type: radio
1. Yes
2. No
Looping through questions in a group
To create a loop for a group of questions, apply the loop for tag to a start group widget and specify the list of elements for which the question(s) will be repeated. In the example below, we use question label shorthand (e.g., loop for: Q20) to reference the selections made in Q20.
Randomizing content within a group
As with lists, content within a group can be ordered or randomized. To order content within a group, apply the order tag to the group definition. The order tag supports all of the same inputs as it does when used with lists.
In the example below, Q1, Q2, and Q3 are displayed on separate pages. All pages will be randomized ([*]), and the final page will be anchored ($), which is Q3. Note, although Q2 will be randomized within the group, Q2's options will remain in the order they are programmed.
start group: RANDOMIZE
order: [*],$
1. This question could be shown first or second.
type: text
2. This question could be shown first or second as well.
type: radio
1. Yes
2. No
3. This question is anchored in place with the '$' symbol, and will always be last.
type: text
end group: RANDOMIZE
Randomizing nested groups
order tag also works with nested groups so that content (pages with text, questions, and groups) can be ordered within other ordered groups. In this next example, INNER_GROUP_A and INNER_GROUP_B are randomized, so some respondents see questions 3 and 4 first, while others see questions 1 and 2. The content within each groups is also randomized. However, each set of randomized questions will always appear together.
start group: OUTER_GROUP
order: [*]
start group: INNER_GROUP_A
order: [*]
1. Question 1 is randomized with question 2.
type: radio
1. Yes
2. No
2. Question 2 is randomized with question 1.
type: radio
1. Yes
2. No
end group: INNER_GROUP_A
start group: INNER_GROUP_B
order: [*]
3. Question 3 is randomized with question 4.
type: radio
1. Yes
2. No
4. Question 4 is randomized with question 3.
type: radio
1. Yes
2. No
end group: INNER_GROUP_B
end group: OUTER_GROUP
Comments
0 comments
Please sign in to leave a comment.