QUESTIONS
Introduction
A questionnaire is made up of a number of questions.
A question is made up of several elements which are defined in the QUESTIONS section of the dsc script file.
Q1 [dimension] "Question text?" : response_type attribute_keyword(s) : parameter(s) @[question_attribute=value,...]
Question Name
Each question must have a unique name. The name must start with a letter and can only contain letters (without accents), numeric characters and the underline character "_". The CAWI language is case sensitive so that, for example, question Q10 is different to question q10. Example names :
q1
Q13b
QuestProfession
Department_01
Dimension
Multidimensional (or array) questions make it possible to display multiple questions in a single table. The most frequent use is to cross a list of elements (or items) with a list of responses (or values) : the responses can be single ("single choice") or multiple ("multiple choice").
Such questions are usually presented in the form of a grid (or table) : the items appear vertically down the side of the table and the possible response values are displayed across the top of the table. The items can also be crossed with text fields, integer(whole) numbers, decimal numbers, etc according to the type of question.
For multidimensional questions the dimensions are placed in brackets [ ] or { }. A dimension can be a single number or a list of elements between double quotes ("), separated by commas.
Example 1:
Q1[3] "Name 3 brands that you know" : TEXT
Example 2:
Q1{
1 "Brand 1",
2 "Brand 2",
3 "Brand 3"
} "Do you know the following brands?" : {
Y (1) "Yes",
N (2) "No"
}
| Yes | No | |
|---|---|---|
| Brand 1 | ||
| Brand 2 | ||
| Brand 3 |
Respondent to select Yes or No for each brand.
Example 3: ```Q1{ 1 "Statement 1", 2 "Statement 2", 3 "Statement 3", 4 "Statement 4", 5 "Statement 5" }{ 1 "Brand 1", 2 "Brand 2", 3 "Brand 3" } "For each statement, give a mark from 1 to 10 to indicate how far it applies to the brands shown." : 1..10
| | Brand 1 | Brand 2 | Brand 3 |
| ----------- | ------- | ------- | ------- |
| Statement 1 | | | |
| Statement 2 | | | |
| Statement 3 | | | |
| Statement 4 | | | |
| Statement 5 | | | |
Respondent to enter 1 to 10 in each cell of the table.
### Notes
In the 2 examples above `{ }` have to be used to bracket the lists of array elements. This is because numeric values have been used as the [names](#chcomponents) of the array elements and the current version of SCROLL would not accept the syntax if `[ ]` were used.
When creating questions where the dimension is defined as a list it is good practice to use the [DEFINITIONS](overview#definitions) section to define the list and then use the list name when defining the questions. So Example 2 above would be defined as below:
lst_brands={ 1 "Brand 1", 2 "Brand 2", 3 "Brand 3" }
Q1[brandlist] "Do you know the following brands?" : { Y (1) "Yes", N (2) "No" }
This method is better for using [list operations](route#lists) involving different questions based on the same list.
## Question text
The question text is a character string between double quotes.
Examples :
The display of the text may be changed using the mark up conventions [described below](#markup). As certain characters are used for these mark ups (principally " and @ and $), they must be preceded by the backslash character ("\") to be keep their genuine representation as in the second example above.
The response from a previous question can be substituted in the question or label text or a message by using __@ANS__:*question_name*$ as in the example below:
## Response Type
Define the types of response that can be given to the question.
### List of choices
May be:
* single : one choice from a list
* multiple : multiple choice - more than one response can be given
Example of a list of choices question where up to 3 responses can be selected:
Without the `{3}` then only a single response may be selected. Note that the maximum number of choices allowed can be reduced dynamically in the [ROUTE](20103) section using the [SETQMAXSEL](20105#setqmaxsel) function.
Use square brackets, e.g. `[3]`, to preserve the order in which choices are selected. For example when the choices have to be ranked.
See [Components of a choice definition](#chcomponents) for a description of the 3 components that can be defined for a choice.
See [Choice attributes](#cattributes) for a description how extra attributes (e.g. *exclusive choice*) can be used for a choice element.
### TEXT: enter a single row of text
### OPENTEXT : for longer text responses - more than one row.
### INTEGER: Whole number
See [INTEGER](20105#integer) for a full description of rules for defining integer ranges.
The example below shows an older way of specifying whole number ranges that is still accepted.
### DECIMAL: Numbers that can contain decimal points
See [DECIMAL](20105#decimal) for a full description of rules for describing decimal numbers.
The example below shows an older way of specifying decimal number ranges that is still accepted.
### DATE
## Question options
Questions options are used define some characteristics of a question, such as whether it must be answered for the respondent to continue or the maximum number of answers. Several options can be used for the same question in which case they are separated by spaces.
Examples :
## Question Attributes
Question attributes can be used to define text associated with the question. For example to add a question note or alter
the message displayed when a respondent does not answer a required question.
Examples
## Parameters
Parameters can be added to specify how the question is to be displayed. Parameters are set using pairs of the form parameter_name=value, with each pair separated by commas. The list of pairs is then enclosed in double quotes.
Examples :
Parameters are specified following a "**:**" after the question definition. Example:
To see list of parameters select *List of dsc parameters* from menu or [click here](20104)
## Additional features
### Mark up features to change the way text displayed
The mark ups below can be used to alter the display of the question and label text.
* New line: "@|" e.g. "First line@|Second line"
* <u>Underline</u>: @U$text to be underlined@$
* **Bold**: @B$text in bold@$
* *Italic*: @I$text in italics@$
* Quotation marks: \"
* Superscript: @SUP$text to be displayed as superscript@$
* Subscript: @SUB$text to be displayed as subscript@$
* Link: @LNK:http://www.sda-ltd.com$SDA Ltd (optional)@$
Text can be given classes or IDs which can be used to set styles in the [project css](30101):
* **$class: *class_name* $** text **@$**
* **$id: *id_name* $** text **@$**
Example 1:
Have you <u>seen</u> "Spartacus" ?`
Example 2:
Which __daily newspapers__ do you read ?
Please select all the apply.
Example 3:
1<sup>st</sup> question: What is H<sub>2</sub>O?
Example 4:
With the class defined in the [project css](30101):
###Collecting 'Other' answer text
Respondents can be offered a text box in which to record more details when selecting an 'Other' answer.
Example:
QUESTIONS
Note that more than one 'Other' answer choice can be used in a question.
### Extended response types {#extended-domains}
Additional lists of possible responses can be added after the [response type](#resptype) in the question definition. This is most commonly used for adding *Don't Know* or *Refusal Codes* to text or numeric response types.
Examples:
dkrf ={ DK "Dont Know", RF "Prefer not to answer" }
Q1 "How many?" : INTEGER + dkrf Q2 "Where was that?" : TEXT + dkrf Q3 "Did you?" : {yes,no} + {1 "Not sure but probably Yes",2 "Not sure but probably No"}
By default items in the extended response list will be displayed underneath the main question response(s).
### Components of a choice definition in a list of choices question:
There are 3 components to each choice in a list of choices: Name, Tag and Label.
Choices can optionally be given [choice attributes](#cattributes) described below.
The name/tag/label combinations for each choice are separated by commas and usually written on different lines to make the specification more readable.
label1, label2 and label3 are the texts associated with each response to be displayed on screen to respondents.
tag1, tag2 and tag3, in brackets, are the tags associated with each response. The tags will be the values used in the data set produced from the survey responses although there are options to change this when exporting the data.
name1, name2, and name3 are the names used for the possible responses to a question. Names provide a convenient way to refer to a response in the scripting language. They can make the script more concise and readable.
Not all of Name, Tag and Label are required. If not all are specified then SCROLL will generate values/text for the others according to the following rules.
The number Nb indicates the maximum number of choices that can be made from the list of responses. The absence of `{Nb}` means that only a single response may be entered.
Use square brackets [Nb] rather than curly brackets to record selection order.
[Back to start](#start)
### Choice attributes
The choices in a list of choices question can optionally be assigned additional attributes called choice attributes defined after the question label with the syntax below:
Example: xchoice attribute to make a choice exclusive.
If 'None of these' is selected then any other choices already selected will be automatically deselected.
The following attributes are predefined in the CAWI language which provides options to control how these attributes are used:
* **xchoice**='yes' - make choice exclusive. See example above.
* **image**="@image.png" choice made by selecting an image.
* **cnotes**="*additional text associated with the category*" - see full example program below
Examples:
As well as the attributes recognised by the CAWI system new attributes can be defined. *division* is a user defined attribute in the example below.
Full example program:
```DEFINITIONS
lst_services = {
1 "Academic Support Office" @[cnotes="Co-ordinating processes for assuring the quality of educational provision",division="Academic Support"],
2 "HR Services" @[cnotes="Central HR processing and administration",division="Human Resources"]
}
QUESTIONS
Q1 "Which service" : services REQUIRED
Q2 "Why did you select @ANS:Q1$" : OPENTEXT
ROUTE
NEWPAGE()
ASK(Q1,'cnotes=yes')
ENDPAGE()
NEWPAGE()
MESSAGE("You have selected the @ANS:Q1$ in the " + GETCATTR(Q1,Q1,'division','') + " division: " + GETCATTR(Q1,Q1,'cnotes',''))
ASK(Q2)
ENDPAGE()
If HR Services is chosen at Q1 the MESSAGE statement will display:
You have selected the HR Services in the Human Resources division: Central HR processing and administration
If cnotes is set to "yes" in the ASK then the the cnotes text is displayed next to the main choice labels. Otherwise only the main choice labels are displayed.
Go to GETCATTR for a description of the GETCATTR function.
Question Groups
Groups of questions can be defined to combine several fields of answers, or several questions.
Examples:
Q10 "When did you catch the train ?" : (
hour "Hour" : 0..23 REQUIRED,
minute "Minutes" : 0..59 REQUIRED
)
The next example displays a grid with Child1, Child2, Child 3 as the rows and the questions in the group as columns.
Q11 {
1 "Child 1",
2 "Child 2",
3 "Child 3"
} "Can you provide a few details about your children." : (
Name "Name" : TEXT[64] REQUIRED,
age "Age" : 0..18 REQUIRED,
sex "Sex" : {
M (1) "Male",
F (2) "Female"
} REQUIRED
)
The question definitions in the group are separated with commas and parentheses () are used to enclose the list of questions.