Coded variables for radio, checkbox, and numeric input questions can be created via the question types coded single select, coded multiple select, and coded number, respectively. These question types are hidden/non-respondent facing variables derived from responses to other questions, and can work alongside both quotas and click balance quotas.
The coded variable types include some built-in properties, equivalent to the following in previous versions of IntelliSurvey.
New Type | Defaults/Equivalent to |
---|---|
type: coded single select |
type: radio selectby: condition
|
(alias |
type: checkbox selectby: condition
|
type: coded number |
type: number invisible: y
|
Tip! Although selectby: condition
is built into both coded single select and coded multiple select question types, SPs may override this behavior by applying a different selectby
input, such as selectby: weight
.
See below for examples.
Syntax
Basic syntax for coded single select, coded multiple select, and coded number variables is as follows.
# basic coded single select 1. Coded single select variable type: coded single select 1. Opt 1 2. Opt 2 3. Opt 3, etc. # basic coded multi-select variable 2. Coded multiple select variable type: coded multiple select 1. Opt 1 2. Opt 2 3. Opt 3, etc. # basic coded numeric variable 3. Coded number variable type: coded number cvalue: value, expression, or logical statement
Tags
The following tags can be applied with coded variables.
Tag | Description | For use with... |
---|---|---|
selectby |
Specifies how respondents are assigned to a group/groups when they may qualify for more than one. Common
The |
For use with all three coded variable types; users should note that both coded single select and coded multiple select, by default, utilize |
cvalue |
Calculates and sets a value for a question or variable when the parent page is submitted. cvalue accepts any logical statement or Perl expression for input. |
Used with coded number variables; required with selectby: calculate . |
maxgroups |
Specifies the maximum number of options or quota groups that a respondent may be assigned to, provided that the respondent meets qualifying condition criteria and, in the case of a quota, the bucket is not full. | For use with coded multiple select variables. |
quotas |
Setting to 'y' creates a quota variable based off the question of the format QX_QUOTA, where "X" is the original question's ID. | For use with coded single select and coded multiple select. |
(alias |
Setting to 'y' creates a "click balance quota," a quota that is based on all incoming traffic, instead of only completes like a typical quota. Click balance quota variables created in this manner have the format of QX_CBQ, where "X" is the original question's ID. The |
For use with coded single select and coded multiple select. |
Example
For the purposes of this article, we will use an extended example to illustrate various ways in which coded variables can be utilized. The following set of questions asks respondents for their familiarity with and usage of various grocery stores, examining whether they tend to use "supermarkets" or "club/warehouse" grocers more frequently.
Coded single select
Coded single select variables, by default, operate as if selectby: condition
is built into them. Options therefore require conditions to specify how the respondent should be categorized. If no condition is present it will evaluate as 'true,' and a respondent could be placed into a bucket erroneously.
CLUB. Is primary store club or grocery? type: coded single select 1. Supermarket { if anyChecked($QPRIMARY,1..7) } 2. Club / Warehouse { if anyChecked($QPRIMARY,8..10) }
Coded multiple select
Like coded single select variables, coded multiple select variables default to selectby: condition
and require that options/groupings are conditioned.
HEARD. Stores heard of but never shopped type: coded multiple select optsfrom: STORES { if anyChecked($Q1,[id]) and noneChecked($Q2,[id]) }
Overriding default selectby inputs
Other selectby
inputs can be utilized with both coded single select and coded multiple select variables.
PRIMARY. Store where majority of shopping done type: coded single select selectby: weight optsfrom: STORES { weight: $Q3R[id] } TOP2. Top 2 Stores where shopping done type: coded multiple select maxgroups: 2 selectby: weight, counts optsfrom: STORES { weight: $Q3R[id] }
If applying selectby: calculate
, be sure to specify how the values are calculated with the cvalue
tag.
CLUB1. Is primary store club or grocery? (same as QCLUB but using calculate/cvalue) type: coded single select selectby: calculate cvalue: if ($QPRIMARY<8) {1} else {2} 1. Supermarket 2. Club / Warehouse
Coded number variables
Coded number variables calculate input based on the logic expressions or math specified in the cvalue
tag as shown below.
TOTAL_SPEND_GROCERY. Total Spend at Grocery Stores type: coded number cvalue: $Q3R1 + $Q3R2 + $Q3R3 + $Q3R4 + $Q3R5 + $Q3R6 + $Q3R7 TOTAL_SPEND_CLUB. Total Spend at Club Stores type: coded number cvalue: $Q3R8 + $Q3R9 + $Q3R10
Comments
0 comments
Please sign in to leave a comment.