Calling a Function From a DEFINE, COMPUTE, or VALIDATE Command

How to:

You can call a function from a DEFINE command or Master File attribute, a COMPUTE command, or a VALIDATE command.

Syntax: How to Call a Function From a COMPUTE, DEFINE, or VALIDATE Command

DEFINE [FILE filename] 
tempfield[/format] = function(input1, input2, input3, ... [outfield]);
COMPUTE 
tempfield[/format] = function(input1, input2, input3, ... [outfield]);
VALIDATE 
tempfield[/format] = function(input1, input2, input3, ... [outfield]);

where:

filename

Is the data source being used.

tempfield

Is the temporary field created by the DEFINE or COMPUTE command. This is the same field specified in outfield. If the function call supplies the format of the output value in outfield, the format of the temporary field must match the outfield argument.

format

Is the format of the temporary field. The format is required if it is the first time the field is created; otherwise, it is optional. The default value is D12.2.

function

Is the name of the function.

input1, input2, input3...

Are the arguments.

outfield

Is the field that contains the result, or the format of the output value enclosed in single quotation marks. This is required only for external functions.

In Dialogue Manager, you must specify the format. In Maintain Data, you must specify the name of the field.