REFSERIES

Purpose:

Directly references a series without creating a copy in an SPL function.

Syntax:

REFSERIES(series)

series

-

A series, the source series to reference.

Returns:

A series, a direct reference to the source series.

Example:

srange(s)

{

    local r;

 

    if (argc < 1)

    {

        // reference series in current Window

        s = refseries(W0);

    }

 

    r = max(s) - min(s);

    

    return(r);

}

 

If the function srange is invoked without an input series, the input defaults to the series in the current Window. W0 refers to the current Window and the statement:

 

s = refseries(W0)

 

refers to the series in the current Window. In this case, the variable s is a direct reference to the series in the current Window and is assigned without first creating a copy. If the statement was:

 

s = W0;

 

then variable s would be assigned a copy of the series in W0.

Remarks:

As shown in the example, REFSERIES is very useful for defaulting the input to an SPL function to the series in the current Window. Because REFSERIES avoids copying the source series, SPL functions will execute faster for large series.

 

REFSERIES can be abbreviated as REFSER.

 

See REFWINDOW to reference and return a window.

See Also:

CURRENT

END

REFWINDOW

W0