Crosslists are lists built from combining two or more lists. In a crosslist (also spelled "cross list"), a list entry is created for every possible permutation of options from the origin lists. Crosslists create IDs by concatenating the original list IDs and separating them with an underscore. The option text is also concatenated, and is separated with a comma by default. All conditions and option decorator data are also preserved; so, they can be used by any questions or variables which reference the crosslist.
For information on how crosslists affect quotas, see Crosslist quotas.
Note: The crosslist set list must be defined after its component lists and variables in the survey source.
Syntax
setlist: ORIGIN_LIST_A 1. Option A 2. Option B 3. Option C setlist: ORIGIN_LIST_B 1. Option X 2. Option Y 3. Option Z setlist: A_CROSS_LIST crosslists: ORIGIN_LIST_A, ORIGIN_LIST_B
Tags
The following tags may also be used with crosslists.
Tag | Description |
---|---|
crosslist tile |
In the case of a quota widget utilizing a crosslist, the resulting tile on the Quota Manager will be a crosslist quota. To disable this functionality and have the tile display all options as a typical quota, include this tag and set the input to 'n' (no). Also accepts 'y' (yes) input. Note, this tag is valid only with the tag |
crosslistidseparator |
Allows the user to specify how to separate the IDs in the resulting crosslist options in the reports and database; e.g., crosslistidseparator: would result in a displayed option ID such as '13' instead of the default '1_3'. |
crosslisttextseparator |
Allows the user to specify how to separate the text in the resulting crosslist options in the reports and database; e.g., |
Examples
Simple crosslist
With conditions
Conditions are defined with a set of curly braces/brackets surrounding an "if statement" (e.g., {if X then Y}). Conditions on list options are carried forward (persist) and combined on each crosslist option. A common use case for such a scenario is nested demographic quotas, such as crossing the age range and income levels. In the example below, the resulting responses from a text input on income and a pulldown selection of the respondent's age are first mapped to the lists INC_LIST and AGE_LIST respectively, assigning the response to different ranges. These lists are then crossed at set list: AGEINCLIST
and used in the listcall at quota variable AGEINC.
Please scroll through the code to see the full example.
In this example, the AGEINC optsfrom
tag does not need any conditions locally defined, because both sets of conditions on the AGE_LIST and INC_LIST lists are present for every list option. AGEINC, being type: quotas
, will automatically punch, and it will do so for the only applicable option for each respondent based on the conditions initially defined in AGE_LIST and INC_LIST.
Note: If two lists are combined to make a crosslist, and each list has a set of conditions included with it, the conditions do not need to be redefined in the crosslist, as they are automatically carried forward into the crosslist.
Using question IDs
It is possible to build crosslists from questions rather than lists. This reference to a question is called question label shorthand. Just like conditions, referencing a question carries its conditional logic into the crosslist, along with the options defined in it. The following example takes advantage of this feature to further streamline nested income and age quotas.
setlist: GEN 1. Male 2. Female setlist: AGERANGES 18. 18 - 24 {if anyChecked($Q4,1)} 25. 25 - 34 {if anyChecked($Q4,1)} 35. 35 - 44 {if anyChecked($Q4,1)} 45. 45 - 54 {if anyChecked($Q4,2)} 55. 55 - 64 {if anyChecked($Q4,2)} 65. 65 and above {if anyChecked($Q4,2)} 4. What is your gender? type: radio optsfrom: GEN 5. What is your age? type: radio optsfrom: AGERANGES set list: AGEGENLIST crosslists: Q4, Q5 AGEGEN. QUOTA | Age-Gender type: quotas optsfrom: AGEGENLIST
Determining list order
When using crosslists for quotas, the order in which the lists are crossed will determine how they appear in quota tables and graphs. For example, when using lists LISTA and LISTB to create the crossed list LISTAB, if we use crosslists: LISTA, LISTB
then LISTA's elements will make up the row elements in the quota table, with LISTB's elements making up the columns. Reversing the order - crosslists: LISTB, LISTA
- will result in LISTB's elements making up the row elements and LISTA's making up the column elements.
If three lists are crossed, for example, crosslists: LISTA, LISTB, LISTC
, then LISTA's elements will still make up the row elements of the quota table while LISTB and LISTC's element will make up the columns. In this scenario, though, the columns will be listed in order such that the first several columns will be LISTB element 1 combined with each element of LISTC, then LISTB element 2 combined with each element of LISTC, and so forth, until each combination is shown. The list elements will be displayed in numerical order by their ID number. You can review this in more detail in Crosslist quotas.
Caution! Crossing more than three lists is not advised as it could result in overly large data structures. Such needs may be better managed with a different approach.
With decorator data
Additional data stored in lists with option data decorators can also be pulled into crosslists. In the following example, a crosslist created from two lists with custom option data is referenced and displayed to the respondent.
Please scroll to see the full source code.
With desc decorators
Just like conditions and option data decorators, crosslists will also carry forward and combine each pair of a list option's desc
decorator for reports and the Quota Manager. The crosslist will display the preferred description in various reports and follow the default settings of "text, text" unless otherwise specified with the crosslisttextseparator
tag. In the example below, Q4 will display the option label "Male, Gen Z" in all reports instead of the option text "I am a male" and "Under 25."
setlist: GEN 1. I am a male {desc: Male} 2. I am a female {desc: Female} setlist: AGE 1. Under 25 {desc: Gen Z} 2. 26 - 41 {desc: Millenials} 3. 42 - 57 {desc: Gen X} 4. 58 and older {desc: Boomers} setlist: AGEGEN cross lists: GEN, AGE 4. Select one! type: radio quotas: y optsfrom: AGEGEN
With inclusion and exclusion
When crossing two or more lists, it is possible to exclude specific options for one or more of the lists. Looking at our previous example on crosslists built with question IDs (modified below), suppose that anyone who is between the ages of 18 - 24 or 65 or older is automatically disqualified from continuing the survey (termed at Q5A). In this case, the AGEGENDER quota would not need to include individuals in those age ranges as they would not be contributing to data from the rest of the survey. As a result, when creating the crosslist AGE_GENLIST, we can exclude options '18' and '65' from Q5A responses. This will now leave us with eight quota groups for AGEGENDER - Male or Female for the four remaining/accepted age ranges of 25 - 34, 35 - 44, 45 - 54, and 55 - 64.
setlist: GENDER 1. Male 2. Female setlist: AGE_RANGES 18. 18 - 24 25. 25 - 34 35. 35 - 44 45. 45 - 54 55. 55 - 64 65. 65 and above 4A. What is your gender? type: radio optsfrom: GENDER 5A. What is your age? type: radio optsfrom: AGE_RANGES termif: anyChecked($Q5A,18) or anyChecked($Q5A,65) set list: AGE_GENLIST crosslists: Q4A, Q5A -[18,65] AGEGENDER. QUOTA | Age-Gender type: quotas optsfrom: AGE_GENLIST
To instead use inclusion of Q5A's accepted age ranges rather than excluding the options that aren't accepted, simply alter AGE_GENLIST's crosslist definition to the following.
set list: AGE_GENLIST crosslists: Q4A, Q5A [25,35,45,55]
For more information on inclusion and exclusion of options, see Including and excluding options.
Comments
1 comment
Please also note you can reference the original lists' id etc. by using the list name and "_id", for example as follows:
Please sign in to leave a comment.