Closed by scripts (AskiaAnalyse)

Topics in this section:

Overview

This feature allows you to create a closed question (i.e. a question with answer categories), either by using the graphical user interface or with AskiaScript syntax entered directly or copied from a spreadsheet

To access this feature, in the edit menu select create a variable.... Then select closed by scripts.

Commands

The following commands are available above the list of new responses:

ICON NAME EFFECT

Insert

Insert a new response item.

Delete

Delete the selected response item.

Copy

Copy the selected response item to the clipboard.

Paste

Paste a response item from the clipboard (i.e. create a new response item as a duplicate of the last item copied).

Move up

Move the selected response item upwards in the list. You can also drag and drop responses into the desired sequence.

Move down

Move the selected response item downwards in the list. You can also drag and drop responses into the desired sequence.

or_remove_icon

OR (remove items)

Combine the selected response items, using an OR expression, and remove the individual items from the list. To select more than one response item, hold down CTRL as you click each item.

or_leave_icon

OR (leave items)

Combine the selected response items, using an OR expression, but leave the individual items in the list. To select more than one response item, hold down CTRL as you click each item.

and_remove_icon

AND (remove items)

Combine the selected response items, using an AND expression, and remove the individual items from the list. To select more than one response item, hold down CTRL as you click each item.

and_leave_icon

AND (leave items)

Combine the selected response items, using an AND expression, and leave the individual items in the list. To select more than one response item, hold down CTRL as you click each item.

 
  GUI Select this option to define your new variable using the graphical user interface
  Script Select this option to define your new variable by writing AskiaScript commands. 

Import quota settings from Askiafield

Create a quota question based on AskiaField quota data. To do so, click import quota settings from AskiaField.

For more information, see adding a quota variable.

 

Note: when you switch mode between GUI and script, AskiaAnalyse converts your condition to the newly-selected format. For example, if you have defined a condition in GUI mode and then switch to script mode, you are given the option to convert the condition to a script.

Using the Graphical User Interface

If you use the GUI, you can build a definition of the response from up to four responses in other questions. For example, if you wanted to specify females aged 34-49, you would need to specify females from a gender question, and the age group 34-49 from an age question:

 

To define each part of the expression, we click ... next to an empty box, and then select the appropriate question and response. For example:

 

Note that in our example we have used the operator AND to combine the two conditions (female AND 35-49), because we only want to include respondents who are both female and aged 35-49. If we did want to use the OR operator (this would select any respondents who are female, and also any respondents - of either gender - who are aged 35-49), we would simply select the OR radio button between the two expressions.

If we switch to the script mode (click script), we can see that the equivalent askiascript expression has been created for us:

create%20variable%20closed%20by%20script%20example

The icons along the top of the list allow you to combine two or more expressions that you have already defined. Suppose you had defined various age groups of females, as follows:

If you wanted a category containing all females, you might select all the categories in the list (using CTRL+A, or holding down CTRL and clicking them individually) and click the second icon:

or_leave_icon

This icon combines all the selected responses into one category. It also leaves the separate categories in the list. This is useful if you want to check the new, combined category before you remove the individual ones. This icon uses the OR operator, so any respondents who fall into any of the individual categories will be included.

Using drag and drop to create your definition

It is possible to drag and drop variables from the question tree (i.e. the questionnaire tab in the left-hand pane) into the list of responses in the create variable dialog. If you drop two or more questions separately, they are combined, and all the response categories remain separate.

For example, if you dropped gender and age separately, the response list might be as follows:

If you drop two or more questions together, every possible response combination is crossed. In our example, if you dropped gender and age together, the response list might be as follows:

Note that in this example, there is only one category for not asked. This is because we chose to combine the not asked responses for both questions.

When two or more questions are dropped together, an additional dialog appears at the point where you drag questions to the definition window.

closed%20by%20script%20options

Option PURPOSE
Group "Don't know" together

If selected, any Don't know responses will be grouped together so that only one combined Don't know response will be shown. If not selected, Don't know responses will be treated in exactly the same way as any other response. 

Group "Not asked" together

If selected, any Not asked responses will be grouped together so that only one combined Not asked response will be shown. If not selected, Not asked responses will be treated in exactly the same way as any other response. 

Separator

You may enter one or more characters that will be used to separate the names of the two categories to be combined in the new answer code-frame that will be created. If you specify "&", for example, then the first category in previous question gender by age example would be given the label Male & 18-24.

If counts >

When this checkbox is selected, access to the numeric field to the right is permitted so that you can set a minimum count value.

This option allows you to set a minimum threshold for the presentation of any response option. Any whole number from zero or above is allowed. Setting the minimum count to 0 will have the effect of suppressing any response options with zero values. 

Note: we recommend you always activate the If counts > option when working with questions with a large number of response options, as it is very likely that the resulting variable will be sparsely populated when two or more questions are combined. 
If a code-frame is generated with more than 32767 response options, the responses may be incorrectly populated with values. Setting a minimum count will effectively avoid this problem.

 

Copying and pasting captions and definitions from an external spreadsheet

As a convenient alternative to using the Graphical User Interface to creating your definitions, you may write your the captions and syntax for each response option in an Excel spreadsheet (or any similar spreadsheet program) and then in a single copy-and-paste operation, transfer the whole definition to askiaanalyse. This method can save time and effort if you have a large number of repetitive definitions to make. 

To create a variable in Excel:

  1. Start by opening a new Excel worksheet.  Write the captions for each new response option in one column, with the syntax definition in the adjoining cell in the next column, as shown in this example:
    create%20variable%20closed%20by%20script%20excel

  2. In AskiaAnalyse, create your variable using the Create a variable dialog, provide a shortcut name and a caption, and select Closed by scripts as the Type.

  3. Return briefly to Excel and select the region of the spreadsheet containing your definitions, i.e. the two columns and all the rows you have created.

  4. Either select Copy or CTRL+C to copy the selected block of cells on your computer's clipboard.

  5. Switch back to askiaanalyse and click the clipboard icon Insert Clipboard Contents

  6. Askiaanalyse will now create all of the captions and populate the syntax window for each with your definitions. 

  7. Click OK to save your definition. 

Note: it is not currently possible to include line breaks or comments in definitions written in Excel. However, these may be added later, via the GUI.

Script syntax examples

By using script to define the variable, you have full control over the variable definition.

For example, if you wanted to test whether responses 1, 2, or 3 were given for question Q1, you would enter the following:
??Q1?? isincludedin {1;2;3}

If you wanted to test whether brand 3 was stated first at question Q3, you would enter:
??Q3??[1]=3

For more information, see the section describing AskiaScript.

Create your own Knowledge Base