Use the unstackfor
(alias stackfor
) and unstackby
(alias stackby
) tags when building lists with "stacked" data in your survey. This allows reports to automatically display questions using the stacked data with the full brand list "unstacked" rather than the stacked proxy list.
The unstackfor
tag identifies the full parent list being stacked. The unstackby
tag explicitly indicates which survey variables are storing the values for the list being stacked.
Note: In r8 software, use the stackfor
and stackby
tag names. Starting in r9, unstackfor
and unstackby
are also supported with identical functionality.
setlist: BRANDS_B
1. Unstackfor is typically used on very long lists.
2. Acer
3. Apple
4. Dell
5. HP
1B. Select the brands you are familiar with.
type: checkbox
optsfrom: BRANDS_B
2BRANDS_B. 2 Brands Respondent is familiar with
type: checkbox
selectby: counts
maxgroups: 2
optsfrom: Q1B
BR1_B. First Brand
type: coded single select
selectby: calculate
cvalue: $Q2BRANDS_B ->[0]
optsfrom: BRANDS_B
BR2_B. Second Brand
type: coded single select
selectby: calculate
cvalue: $Q2BRANDS_B ->[1]
optsfrom: BRANDS_B
setlist: SEL_BRANDS
unstackfor: BRANDS_B
unstackby: QBR1_B, QBR2_B
101. $QBR1_B_text {if anyChecked($QBR1_B)}
102. $QBR2_B_text {if anyChecked($QBR2_B)}
block: <<END
2B_%%ID%%. Would you recommend %%TEXT%%?
type: radio
desc: Recommend | %%TEXT%%
1. Yes
2. No
3B_%%ID%%. Why?
type: radio
desc: Why recommend | %%TEXT%%
1. My personal experience
2. Somebody else's experience I heard about.
END
list: SEL_BRANDS
Details
-
Add the
unstackfor
tag directly on the stacked proxy list. In the above example, this would be the SEL_BRANDS list. -
The input for
unstackfor
is the parent list. This would be the full brand list, BRANDS_B. - Add the
unstackby
tag on the same stacked list asunstackfor
. The inputs forunstackby
are the variables where each brand (or item being stacked) is selected. This would be QBR1_B and QBR2_B. - The stacked list options are the piped values from the variables referenced by unstackby, for example '$QBR1_B_text' and '$QBR2_B_text'.
- The option IDs for the stacked list cannot overlap with the parent list.
- Lists that use
unstackfor
/unstackby
do not support theorder
,randomize
, oralphabetize
tags. Apply any ordering tags to the parent list instead. - A stacked list (such as SEL_BRANDS) cannot be called by a question or table via an
optsfrom
tag. -
unstackfor
can also be written asstackfor
;unstackby
can also be written asstackby
.
Tip! Including unstackby
is optional if the list options use valid variable names found in the source code with "_text" appended; the software will automatically recognize the variables needed.
Reports
Reports and exports automatically expand stacked fields. They display the questions built from a stacked list using unstackfor
/unstackby
as if each had a separate data location.
Without using these tags, creating a stacked list like SEL_BRANDS would result in a very different data output. See the comparison below.
Stacked data without 'unstackfor' |
Stacked data with 'unstackfor' |
Exporting stacked data
When using the unstackfor
tag, deliverable exports expand the stacked fields by default, which helps analysts unstack the data. However, you can export fields as stacked data instead by deselecting the Expand stacked fields checkbox in the Advanced Export Options menu.
Comments
0 comments
Please sign in to leave a comment.