In AskiaScript, the following miscellaneous functions and operators are available.
| Keyword | Description |
|---|---|
| AVG |
This is askiascript's abbreviation for average. Use this function to calculate the numerical average of responses, including DK and NA. For example: Avg(??Q1??) The above expression returns the mean for the question Q1. |
| Calc |
This function returns the value of the current calculation. Calc(1) replaces the old {1}. You can use the index of the calculation or its caption:
Calc returns DK if the index or the caption is unknown |
| Completed |
This function tests whether the interview was completed (a value of 1 indicates the interview is completed). |
| CvDkNa |
To perform operations on numerical questions that contain non-answers and not interviewed, you must convert the non-answers and the not interviewed to 0: CvDkNa(??Q1??) You can further define the function to convert all responses, along with the system DKs and NAs, to a binary format 0 or 1. The function will convert those values you specify to 1, and all other values to 0. For example: CvDkNa(??Q1??)=55 DKs, NAs and any answer except 55 will be coded into: 0. The value 55 will be coded into: 1. CvDkNa(??Q1??)IsIncludedIn{5 To 10} The following values will be coded into 1: 5, 6, 7, 8, 9 and 10. The following values will be coded into 0: all other values. |
| CurrentCell |
Returns the current cell, as a cell object. |
| CurrentTable |
Returns the current table, as a table object. |
| DK |
Use this operator to refer to the system "Don't know" response (the question was asked, but a respondent gave no answer). DK can be used for category and numeric questions For example: ??Q1??=DK The result will be 1 (true) if there has been no answer to the question and 0 (false), if all individuals have given an answer.
Note: To test the presence of Don't Know in an open question, use the following syntax: ??Q1??="" |
| GetTable (Name, Table) |
Returns a table from the current portfolio as a table object. Name should be expressed as a string; table is optional, and if used, should be a number. Example: |
| Id of interview |
This operator returns the interview ID. |
|
IsEmail |
Use this function to verify that a response conforms to a valid email address format, i.e. x@x.xxx. AskiaVista checks for the presence of the at-sign (@), a dot (.), and the absence of space and accented characters. For example: IsEmail??Q1?? The results is 1 (true) if the email appears to be valid, and 0 (false) if not. |
|
Int |
Abbreviation for Integer. Calculates the integer value of a numeric value containing decimals. For example: Int(??Q1??) if Q1=3.27 the function will return 3.
Integer((??Postcode??)/1000) if Postcode=20850, the result of the expression will be 20, because Integer(20.850) is 20.
Note: this function truncates decimal values, so Int(2.879) will return 2. |
| Interview order | This function returns the interview order (the position of the interview in the QES). |
|
Len() |
Abbreviation for length. Use this function to calculate the length of the data in an open question, which will be returned as a numerical value. For example: Len(??Q1??) if Q1="ABCDEFGHIJKLMNOPQRSTUVWXYZ", the function will return 26.
Note: The function includes spaces when measuring the length of a string of characters, so that if Q1=”A B” the function would return 3. |
| On(, …) |
This function evaluates the specified condition, and returns one of two specified values, depending on whether the condition evaluates true or false. It can be used to assign weights to categories, or to transform numerical values into the value DK. The first parameter specified in the function is the condition that will be evaluated. The second parameter is the value that will be returned if the condition is true, and the third parameter is the value that will be returned if the condition is false. For example: On(Q1=4,10,0) If Q1 is "4", the condition evaluates true, and the function returns the value 10 (given in the second parameter). If Q1 is not "4", the function evaluates false, and the function returns the value 0, (given in the third parameter).
Example 2: To assign the value DK to all those who gave the response 99 for a numerical question, and retain the values given by other respondents, the following syntax would be used: On(??Mark??=99, DK, ??Mark??) |
| Max |
Use this function to retrieve the largest value given for a question, in numerical format. For example, if Q1 is a multi-coded closed question: Max(??Q1??) If Q1={5;3;10}, the function will return the value 10. Max(??Q2??) If Q2 is a numerical question with the values 1,2,3,4, the function will return the value 4. |
| Min |
Use this function to retrieve the smallest value given for a question, in numerical format. For example, if Q1 is a multi-coded closed question: Min(??Q1??) if Q1={5;3;10}, the function will return the value 3. Min(??Q2??) If Q2 is a numerical question with the values 1,2,3,4, the function will return the value 1. |
| Other |
This operator allows you to refer to semi-open responses to closed questions. For example: ??Q1??=OTHER or ??Q1??={1;4;6;OTHER} |
| Seed |
This function returns the interview seed, a unique number. |
| SumAll() | Returns the sum of all the answers in the stated question, i.e. the sum of all the citations. |