The following article provides an introductory look at common question types and the tags used to create them. We will cover both closed-end and open-end questions, and using inline options and standalone list options (a.k.a., setlists) to create them.
Links to supplementary reading on each of these topics will be included, as will interactive examples for you to try out. We suggest bookmarking this page for reference as you learn how to use our survey programming language (SPL).
For information on creating tables, see Table types overview.
Anatomy of a question
Questions make up the bulk of survey content. They can be open-ended, as in text or numeric input questions, or closed-ended, where respondents may select a single response or multiple responses. Questions may also sometimes be known as variables or widgets. A question could be referred to as the [question] widget when we wish to talk about the programming functionality/component, or to highlight it with more specificity to make the topic more clear. A question could be referred to as a variable when we are referring to a question type that is hidden and not shown to respondents, such as a quota or a hidden variable that defines respondent groupings.
All questions, regardless of whether they are open-ended or closed-ended, will include the following properties:
- Question ID – An alphanumeric ID that is a unique identifier for each question or table, and can include underscores; spaces are not allowed. Each question ID will be followed by a period to separate it from the question text, or variable description. When referencing a question in the data or code examples, we use QX, for example Q1.
- Question text – The text displayed to the respondent for a given question. Question text can be multiline/multi-sentence, and even allows for HTML markups to indicate bolding, underlining, or italicizing of text.
-
Question type – A specification of the input type allowed for the question, using the
type
tag. Thetype
tag determines the functionality of the question, whether text is allowed, numbers, single selection, etc. -
Options – Options are required for all closed-end questions. Options can be defined inline, as part of the question's code, or in standalone lists via the
setlist
widget. When options are defined in asetlist
, theoptsfrom
listcall is used in the question code to specify which list, spreadsheet, or previous question the options should be pulled from.- All options will have both an option ID and option text. In the image below, the option '1. Chicago' has an option ID of '1' and 'Chicago' is the option text.
- List options may also be referred to as elements or items.
Besides the type
tag, questions may include additional tags to further define the functionality or appearance. They may specify details such as instructions, acceptable answer ranges for open-ended questions, validations, "decline to answer" responses, text field sizes, and more.
Tip! Inline options are best used in situations where the options will only be used once. If a set of options will be used multiple times, a setlist
should be used instead. In the case of large sets of options, spreadsheets may be used.
For additional information on best practices for when to use inline lists, setlists, or spreadsheets, read our Lists overview article.
Common question types
The following question types are most commonly used in IntelliSurvey's SPL. Click the links below to read the primary documentation on these topics.
Closed-ended question types | |
---|---|
Type | Description |
radio | A single-select question (a.k.a., single choice or single response) that is automatically submitted upon selection. |
pulldown | A single-select question where the respondent chooses a response from a dropdown menu. |
checkbox | A multi-select question (a.k.a., multiple choice or multiple response) where a respondent can select one or more responses. |
listbox | Similar to a pulldown, but allows the respondent to select one or more options. To select more than one option, press and hold the Ctrl key (PC) or the ⌘ key (Mac) and click each option within the listbox. |
rank | A question that requires respondents to rank items in order from first to last. Respondents may be required to rank all items (default) or a subset of items. |
Open-ended question types | |
Type | Description |
text |
A question that provides a text field for respondents to input an alphanumeric response. |
textbox | Similar to a type: text question, but provides a larger text field that can accept longer, "essay" responses. |
number |
A question that requires a numeric input and allows for decimal or integer (whole number) responses, and positive or negative numbers, including 0. |
integer | A question that allows for positive or negative integer responses, including 0. |
uszip5 | A question that requires a five digit numeric response that must match known US ZIP codes. This question type automatically generates hidden variables related to geography derived from the respondent's input. |
Closed-end question examples
Radio questions
The following is an example of a simple radio question in which only a single response is required.
Though it would be unlikely we would need to reuse this set of options, Survey Programmers (SPs) could always create a setlist
, then use the optsfrom
tag to reference the list options. The optional dta
tag (decline to answer, a.k.a., DTA) has been included, which allows respondents to opt out of responding.
If you use a DTA, consider using a higher option ID such as '99' so that, if need be, additional options can be included in the list without having to renumber the DTA ID.
Radio questions with scale and headings
Occasionally clients want to gauge the likelihood to purchase or perceived quality of a particular product/brand. Questions of this nature use a scale format (also called a "satisfaction scale," "Likert scale," "agreement scale," or "NPS" scale).
The following radio question uses a scale from 0 to 10, with 0 being "not likely at all" and 10 being "extremely likely." Although the headings themselves should make it clear how the scale is being used, it is generally a good idea to provide a brief description in the question text itself or as instructions for how the scale is applied. To generate a sequential list of numbers to use for a numeric scale, use the series
function with an optsfrom
tag. The upper and lower bounds are listed in square brackets, separated by two periods, such as series[0..10]
.
Two additional tags have been included here to further clarify the numeric scale – the headings
tag and hscale
tag. The headings
tag specifies the text that can be applied as a single heading, or multiple headings, over the options. The hscale
tag, when set to 'y', will specify to display options horizontally in order, with no line breaks.
Checkbox questions
Checkbox questions allow respondents to make multiple selections within an option set. As such, the respondent must click the Continue (Arrow) button to submit their responses when they are finished. Often the instructions
(alias, instruct
) tag is included to help clarify that multiple selections are allowed.
In this example, we have also included the optional randomize: y
tag, which specifies to display the options in a random order to each respondent.
Checkbox questions with other options
Occasionally clients want to provide respondents with a free text field for any "other" response not included in the defined option list. In these situations we can create "autoother" (or "other") options, such as option 91 in the example below. Like DTAs, autoothers frequently use higher option ID values, such as '91' or '97' in case additional options need to be added to the question or list. If need be, a question or list may contain multiple autoothers.
To create an autoother option, include the autoother: y
decorator on the option ID. Again using option 91 below as an example, this specifies to automatically create a text field next to the word "Other" in which the respondent may provide their own option.
Since the question includes a randomize: y
tag, we have also added an anchor: y
decorator to our autoother option. This specifies to lock option 91 in place, while the other options are randomized for the respondent. Any option can be anchored in place in its display order, though most commonly this is applied to options at or near the end of a list.
For additional information on creating randomized or specific order sequences, see Randomizing and controlling option order.
Checkbox questions with selecting all or selecting none
When it comes to multi-select questions, what happens if you want to select all of the options, or none of them? Instead of forcing a respondent to click each available option, use the selectall
tag to specify an option, which if selected, will automatically select the other options in the set. Similarly, the exclusive: y
decorator can be applied to an option, and if selected, will automatically deselect the other options in the set.
Technically options can be anchored anywhere in the list order, but often the exclusive or selectall options are anchored as the final answer choice(s).
Pulldown questions with prompt
Pulldown questions are single-select questions that allow respondents to choose an option from a dropdown (or pulldown) menu. Frequently, the prompt
tag is used to provide text, or a visual cue such as '<<', to indicate the menu can be expanded.
Listbox questions
Listbox questions look similar to pulldown question, but allow the respondent to select multiple answer choices. The respondent is required to hold down the Ctrl key while selecting their choices on a computer, but on a mobile device, a listbox will act like a checkbox question and allow the respondent to select multiple answer choices. Include the instruct
tag to clarify how to select multiple responses.
Note, unlike checkbox questions, exclusive options in a listbox do not deselect other responses. If an opt-out is required for a listbox, instead use a DTA as shown below.
Note: Autoother options only show the option text "other" without a text field when used in a listbox or pulldown question.
Ranking questions
Ranking questions are designed to allow respondents to rank a set of options from first to last. Unless otherwise specified via the rank
tag, respondents will be required to rank all options in the set. The rank
tag will accept a range or a value as input if only a subset of the options requires ranking.
Open-end question examples
Text questions
The text question type creates a short text field for respondents to input alphanumeric responses. You can restrict the text field size via the size
tag, or restrict the input/response size via the maxlen
tag. The value specified in the size
tag relates to the size in ems, whereas the value specified for the maxlen
tag is the max number of allowed characters (including spaces, hyphens, underscores, or periods).
Unless other tags are used to restrict the input size, it is possible for respondents to exceed the size of the text field specified via the size
tag.
Textbox questions
Textbox questions operate similarly to text questions, but they display a larger box instead. If need be, the minlen
/maxlen
tags can be applied to set a minimum/maximum length for responses.
Numeric input questions
Although text questions can be used for numeric responses, the number and integer question types have built in validations to ensure only numeric inputs are submitted. The 'integer' question type will accept both positive and negative integers (whole numbers), including 0, and the 'number' question type will accept everything an "integer' question type will, plus decimal responses.
Text questions can also use the datatype
tag to restrict the types of input accepted, and, it can be used in addition to the type: number/integer
to further restrict the response. Read more on this scenario below.
Numeric input question formatting options
There are several useful tags that can be included to help format numeric response questions. The prefix
and postfix
tags can be used to include text or symbols before or after the text field, respectively. Similarly, the min
and/or max
tags can be applied to specify the lower and upper bounds that can be accepted as input, though SPs can also just apply the range
tag.
The numberformat
tag is also useful for formatting the numeric groupings and can be used to add in separators. In the example below, numberformat: 0,0.00
tells the system to add a comma after every 3 digits in the value for the respondent, and to allow two decimal places. The currency: y
decorator automatically adds in a currency symbol for the respondent so that they don't have to.
Overriding datatypes
The datatype
tag can be applied to both number or integer questions, and text questions, in order to further restrict the types of responses permitted. In Q11, only positive integers will be allowed due to the inclusion of datatype: whole
. In Q11A, the system will seek responses with '@' and period separators (i.e., local@sld.domain). Specifying datatype: email
ensures that a properly formatted email address is accepted.
US ZIP code questions
The uszip5 question type has a built-in validation and max response length so that only five digit inputs are allowed, and the inputs are matched against a system-stored spreadsheet of current US ZIP codes.
By default, this question type also automatically generates several other variables that can be used for location-based demographics, including the following:
- Q[id]_STATE – The state associated with the ZIP Code, including Washington, DC and State not found.
- Q[id]_REGION – The region of the U.S. associated with the ZIP Code; options include Northeast, Midwest, South, or West.
- Q[id]_DIVISION – The division of the U.S. associated with the ZIP Code; options include New England, Middle Atlantic, East North Central, West North Central, South Atlantic, East South Central, West South Central, Mountain, or Pacific.
- Q[id]_CBSA – The Core Based Statistical Area (CBSA) as defined by the US Census Bureau, which consists of metropolitan and micropolitan areas in the U.S.
- Q[id]_MSA – The Metropolitan Statistical Area (MSA) associated with the ZIP Code as defined by the US Census Bureau.
- Q[id]_USR – The Urban-Suburban-Rural (USR) designation associated with the ZIP Code; options include Urban, Suburban, Rural, and Not categorized.
Notice that [id] is a way to show a placeholder which will be substituted with the same question ID used at the uszip5 question. In the example below, Q12 will be used to create all related variables such as Q12_STATE. To reference any of the text responses for any of the above variables, add a '$' in front of the variable name, and "_text" after it, as shown below.
Comments
0 comments
Please sign in to leave a comment.