STATLAST

The STATLAST function returns the last value in the current status list of a dimension or a dimension surrogate, or in a valueset.

Return Value

The data type returned by STATLAST is either the data type of the dimension or dimension surrogate value or an INTEGER that indicates its position in the default status list of the dimension. See "Automatic Data Conversion of Returned Dimension Values".

Syntax

STATLAST(dimension)

Parameters

dimension

A text expression whose value is the name of a dimension, a dimension surrogate, or a valueset.

Usage Notes

Automatic Data Conversion of Returned Dimension Values

The dimension value returned by STATLAST is converted to a number or a text value, as appropriate to the context. Suppose, for example, that jun95 is the sixth month value but the last value in the current status list. The value of STATLAST(month) can be assigned either to a text variable or a numeric variable.

The following statements produce a text output value.

DEFINE textvar TEXT
TEXTVAR = statlast(MONTH)
SHOW textvar
Jun95

In contrast, these statements produce a numeric output value.

DEFINE intvar INTEGER
INTVAR = STATLAST(month)
SHOW INTVAR
6

Examples

Example 8-109 Setting Status with STATLAST

The following line from a program uses STATLAST to limit month to the values in the status, beginning with a month that has been stored previously in a variable called onemonth, and ending with the last value in the status.

LIMIT month KEEP onemonth TO STATLAST(month)

STATLAST is used here, rather than a particular month value, so that the limit can work on any status list.