Skip Headers

Oracle® OLAP DML Reference
10g Release 1 (10.1)

Part Number B10339-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

LAGDIF

The LAGDIF function returns the difference between the value of a dimensioned variable or expression at a specified offset of a dimension prior to the current value of that dimension and the current value of the dimensioned variable or expression.

Return Value

DECIMAL or NA when you try to lag prior to the first period of a time dimension.

Syntax

LAGDIF(variablendimension, [STATUS|NOSTATUS|limit-clause] )

Arguments

variable

A variable or expression that is dimensioned by dimension.

n

The offset (that is, the number of dimension values) to lag. LAGDIF uses this value to determine the number of values that LAGDIF should go back in dimension to retrieve the value of variable. (See "Negative n Value".) To count the values, LAGDIF uses the default status, unless you use the STATUS keyword or the limit-clause argument to specify a different dimension status list.

dimension

The dimension along which the lag occurs. While this can be any dimension, it is typically a hierarchical time dimension of type TEXT that is limited to a single level (for example, the month or year level) or a dimension with a type of DAY, WEEK, MONTH, QUARTER, or YEAR.

When variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or YEAR and you want LAGDIF to use that dimension, you can omit the dimension argument.

STATUS

Specifies that LAGDIF should use the current status list (that is, only the dimension values currently in status in their current status order) when computing the lag.

NOSTATUS

Specifies that LAGDIF should use the default status (that is, a list all the dimension values in their original order) when computing the lag.

limit-clause

Specifies that LAGDIF should use the default status limited by limit-clause when computing the lag. You can use any valid LIMIT clause (see the entry for the LIMIT command for further information). To specify that LAGDIF should use the current status limited by limit-clause when computing the lag, specify a LIMIT function for limit-clause.

Notes


NASKIP2 Is Ignored

LAGDIF ignores NASKIP2. NASKIP2 does not control how NA values are treated in OLAP DML functions. It only controls arithmetic operations (involving the + (plus) and - (minus) operators) that are executed at the command line and in programs, models, and formulas.


Negative n Value

Normally, n is a positive integer that indicates the number of time periods (or dimension values) before the current one. When you specify a negative value for n, it indicates the number of time periods after the current one. In this case, LAGDIF compares the current value of the time series with a subsequent value.

Examples

For an example of using LAGDIF, see Example 15-31, "Using LAGDIF and LAGABSPCT".