Functions and Operators

Introduction

Functions modify the value of one or more variables to produce a result (i.e., ROUND(2.33333) produces the value 2).

Operators are used to combine two items (i.e., the + operator combines Var1 and Var2 to produce a sum, as in Var3=Var1+Var2).

Functions and operators appear within commands and are used for common tasks that include extracting a year from a date, combining two numeric values, or testing logical conditions.

Almost all functions require arguments enclosed in parentheses and separated by commas. If arguments are required, do not place any spaces between the function name and the left parenthesis. Syntax rules must be followed. Text strings must be enclosed in quotes. Parentheses must enclose arithmetic expressions and can explicitly control the order of operations. Parentheses also enclose function arguments.

 

Syntax Notations

The following rules apply when reading this manual and using syntax:

 

Syntax

Explanation

ALL CAPITALS Epi Info commands and reserved words are shown in all capital letters similar to the READ command.
<parameter> A parameter is information to be supplied to the command. Parameters are enclosed with less-than and greater-than symbols or angle brackets < >. Each valid parameter is described following the statement of syntax for the command. Parameters are required by the command unless enclosed in braces { }. Do not include the < > symbols in the code.
[<variable 1>] Brackets [ ] around a parameter indicates that there can potentially be more than one parameter.
{<parameter>} Braces { } around a parameter indicate that the parameter is optional. Do not include the { } symbols in the code.
| The pipe symbol ’|’ is used to denote a choice and is usually used with optional parameters. An example is in the LIST command. You can use the GRIDTABLE or the UPDATE option, but not both. The syntax appears as follows with the pipe symbol between the two options: LIST {* EXCEPT} <VarNames> {GRIDTABLE | UPDATE}.
     /* 

*/

The combination of backslash and asterisk in the beginning of a line of code and an asterisk and backslash, as shown in some code samples, indicates a comment. Comments are skipped when a program is run.
” “ Quotation marks must surround all text values as in:
 DIALOG "Notice: Date of birth is invalid."
Page last reviewed: September 16, 2022, 12:00 pm