The cross by
tag crosses the question or variable options by another list and creates a crosslist.
S1. What country are you in?
type: radio
1. US
2. UK
97. Other {term: y}
S2. Select your age range.
type: radio
1. 18 - 34
2. 35 - 54
3. 55 + {term: y}
CNTRY_AGE. Country x Age quota
type: quotas
optsfrom: QS1 -[97]
cross by: QS2 -[3]
In the example above, the cross by
tag placed on QCOUNTRY_AGE creates a quota crossing the country selected at QS1 with the age group from QS2. Both lists in optsfrom
and cross by
use question label shorthand.
Details
The cross by
tag is a shortcut that eliminates the need to create a separate crosslist before using the crossed options at a question or variable. The resulting option set is the same as a list created with the crosslists
tag.
-
cross by
works with closed-ended questions and variables, including quotas. - For most questions, the
cross by
tag is placed on a separate line. However, when used withcreate quota
, thecross by
decorator is used inline. - The
cross by
tag supports any list type as input, including question label shorthand, as shown above. - Like other list tags,
cross by
allows inclusion, exclusion, and series syntax, (e.g.,cross by: QS2 -[3]
). - Crosslist option IDs are created by joining the original list IDs with underscores, and option text in joined with commas.
-
Crossing multiple lists is supported, e.g.,
cross by: QS1, QS2
. - To store a summary of the selected options from an individual list, use the
uncrossed punch summary
tag. - In the Quotas applet, crosslist quotas appear in a grid, where the first list is used for the rows and the remaining list(s) are used for the columns. Add
crosslist tile: n
to display crosslists as standard quota rows, instead of a table format.
Caution! Be cautious when crossing three or more lists, as they can lead to complex and extremely large data structures.
Additional examples
Comparing 'cross by' to the 'crosslists' tag
As mentioned above, cross by
is a shortcut for achieving the same result as the crosslists
tag. However, use crosslists
when:
- You need to change how IDs are separated using the
crosslist id separator
tag. - You need to change how option text is separated using the
crosslist text separator
tag. - You want to carry forward option data from each list.
Below is a side-by-side comparison of the SPL for both tags.
'crosslists' tag | 'cross by' tag |
set list: COMBINEDLIST |
1. question or variable here |
Using 'cross by' as a decorator and excluding options
At QS3 below, the cross by
decorator is placed inline with the create quota
tag. Then, exclusion syntax is used to filter out option 97 from the quota option set.
S1. What country are you in?
type: radio
1. US
2. UK
97. Other {term: y}
S3. What is your income?
create quota: CNTRY_INC {desc: Country x Income} {cross by: QS1 -[97]}
type: radio
1. -29,999
2. 30,000 - 49,999
3. 50,000 - 99,999
4. 100,000 - 349,999
5. 350,000+
Creating a quota with a 'create closed' variable
Use the create closed
tag to generate a variable with a closed-end option set from an open-ended question, like SAGE below. You can then reference the variable's option set like any other list (e.g., cross by: QAGE
).
set list: AGE_RANGE
1. 18-24
2. 25-34
3. 35-44
4. 45-54
5. 55-64
6. 65-74
7. 75+
SAGE. What is your age?
type: text
datatype: whole
create closed: QAGE {list_id: AGE_RANGE} {desc: Age ranges}
term if: $QSAGE > 18
SGENDER. What is your gender?
create quota: GEN_AGE {desc: Gender x Age} {cross by: QAGE}
type: radio
1. Male
2. Female
3. Prefer not to say
Limiting quota visibility for PFMs with the 'panel' variable
To ensure PFMs (Panel Field Managers) see only their panel's data when crosslist quotas cross panel data by a quota, use the $panel
variable. In the example below, we cross the $panel
variable by the country selection. Now, a PFM can only see the "Country by Panel" quota counts that are relevant for their respective panel.
S1. What country are you in?
create quota: CNTRY {desc: Country x Panel} {cross by: panel}
type: radio
1. US
2. UK
97. Other {term: y}
Crossing more than two lists
To cross three lists, input two lists separated by commas in the cross by
tag. The list referenced at optsfrom
forms the rows, while the first and second lists in cross by
combine to create the columns.
In QCNTRY_AGE_GENDER below, the country options from QS1 form the rows, while age and gender options combine to form the columns (e.g., 18-34, Male).
S1. What country are you in?
type: radio
1. US
2. UK
97. Other {term: y}
S2. Select your age range.
type: radio
1. 18 - 34
2. 35 - 54
3. 55 +
S3. What is your gender?
type: radio
1. Male
2. Female
97. Other or prefer not to respond
CNTRY_AGE_GENDER. Country x Age x Gender quota
type: quotas
optsfrom: QS1 -[97]
cross by: QS2, QS3
Applying 'uncrossed punch summary'
The uncrossed punch summary
tag creates a variable that records the summary of the selected options from an individual list.
In the example below, QAD selects a single option from the crossed ADS and QCNTRY lists (for example, 2_1. UK, Ad 1) — while the uncrossed punch summary variable stores just the ad (for example, Ad 1). The summary variable uses the ADS list as its option set by default because it is the list used by QAD. Lastly, because QAD is single select, QAD_SUM is also single select.
set list: COUNTRIES
1. US
2. UK
CNTRY. Automatically populated country variable
type: radio
invisible: y
optsfrom: COUNTRIES
dvalue: 2
set list: ADS
1. Ad 1
2. Ad 2
3. Ad 3
AD. Assigned Ad by country
type: quotas
optsfrom: ADS
cross by: QCNTRY
uncrossed punch summary: QAD_SUM. Assigned Ad
Comments
0 comments
Please sign in to leave a comment.