Script (calculation properties) (AskiaAnalyse)

You can use scripts to carry out arithmetic operations on the result of other arithmetic operations, and display the result (and, if you wish, hide any intermediate operations). Scripts can return a number (e.g. weighted counts or unweighted counts) or a string (such as displaying a custom text or message to indicate that something is significant).

To access this dialog, in the calculation properties window click script.... Note that the script... button is available only for "script" calculation types.

Note: scripts use askiascript syntax.

You should enter the script details directly into the dialog (see below for details). For example, the following script calculates the percentage of the impact of the weighting on the frequencies:

When you click OK, you are returned to the calculation properties dialog. To hide this calculation (which you may want to do when you are using it as an intermediary step in a larger calculation), simply ensure that hide this calculation (but leave it available for arithmetics or conditional formatting) is checked.

Note: you can drag and drop questions or responses directly into the script window to quickly place their shortcuts into your script syntax.

When entering your script, you can refer to other calculations by their name inside double quotation marks (which is recommended) or by using the numbers in the table at the bottom of the dialog (we do not recommend this method, however, because the list of calculations, and hence the numbers, can change). In our example above, we use Calc("Unweighted Percentage") to refer to the unweighted percentage, for example (we could also use Calc(2), but as noted, this is not the recommended method). You can quickly insert a reference to a calculation by double-clicking it in the list (e.g. double-clicking 1 places Calc(1) in the list).

If you select hide this calculation, you ensure your calculation will not appear in tables and charts, but it can still be used as the basis of further calculations (i.e. using other scripts), or in conditional formatting.

Several keywords are available to allow statistical functions:

The Student and Khi2 keywords must be given a "degrees of freedom" parameter. For example, if you wanted to use the Z-score and obtain the probability that it is significant, you could use the following formula:

Normal (abs ( Calc("Z-Score") ) )* 100

You can also use calculation arithmetic as a string for visual representations of the frequencies with a formula like the following:

ForSum ("i",Calc(2)/4,"*")

Note: if you mistakenly refer to a non-existing calculation in your formula (either by using an invalid number or by mis-typing the calculation caption) then zero will be returned.
Note: a worked example of calculation scripts can be found in the following article: example of the script calculation feature. An example of using scripts to create mean summary tables can be found here.
Note: by using the keywords RowQuestion, RowSubQuestion, ColQuestion and ColSubQuestion, you can create scripts that apply to different data sets, not just the one currently being used when you define the script. This allows you to save tab templates that can be used with different data-sets with little or no editing.
Create your own Knowledge Base