Using Functions in Expressions

You can also use predefined functions in expressions. More than 70 built-in functions are available, including:

  • Arithmetic functions
  • Statistical functions
  • Distribution functions
  • Logical functions
  • Date and time aggregation and extraction functions
  • Missing-value functions
  • Cross-case functions
  • String functions

Functions are organized into logically distinct groups, such as a group for arithmetic operations and another for computing statistical metrics. For convenience, a number of commonly used system variables, such as $TIME (current date and time), are also included in appropriate function groups.

Pasting a Function into an Expression

To paste a function into an expression:

  1. Position the cursor in the expression at the point where you want the function to appear.
  2. Select the appropriate group from the Function group list. The group labeled All provides a listing of all available functions and system variables.
  3. Double-click the function in the Functions and Special Variables list (or select the function and click the arrow adjacent to the Function group list).

The function is inserted into the expression. If you highlight part of the expression and then insert the function, the highlighted portion of the expression is used as the first argument in the function.

Editing a Function in an Expression

The function is not complete until you enter the arguments, represented by question marks in the pasted function. The number of question marks indicates the minimum number of arguments required to complete the function.

  1. Highlight the question mark(s) in the pasted function.
  2. Enter the arguments. If the arguments are variable names, you can paste them from the variable list.

Next