timeFilters

expectedRange

Description

Computes the range and moving relative range for each time series observation in the input data. This action is useful for analyzing volatility and stability within time series data by calculating expected ranges over specified windows.

timeFilters.expectedRange <result=results> <status=rc> / casOut={ caslib="string", compress=TRUE | FALSE, indexVars={"variable-name-1" <, "variable-name-2", ...>}, label="string", lifetime=64-bit-integer, maxMemSize=64-bit-integer, memoryFormat="DVR" | "INHERIT" | "STANDARD", name="table-name", promote=TRUE | FALSE, replace=TRUE | FALSE, replication=integer, tableRedistUpPolicy="DEFER" | "NOREDIST" | "REBALANCE", threadBlockSize=64-bit-integer, timeStamp="string", where={"string-1" <, "string-2", ...>} }, * dttmName="string", * expectedRangeWindowLength=64-bit-integer, * rangeWindowLength=64-bit-integer, * timeSeriesTable={ caslib="string", computedOnDemand=TRUE | FALSE, computedVars={{ format="string", formattedLength=integer, label="string", * name="variable-name", nfd=integer, nfl=integer }, {...}}, computedVarsProgram="string", dataSourceOptions={key-1=any-list-or-data-type-1 <, key-2=any-list-or-data-type-2, ...>}, groupBy={{ format="string", formattedLength=integer, label="string", * name="variable-name", nfd=integer, nfl=integer }, {...}}, groupByMode="NOSORT" | "REDISTRIBUTE", importOptions={fileType="ANY" | "AUDIO" | "AUTO" | "BASESAS" | "CSV" | "DELIMITED" | "DOCUMENT" | "DTA" | "ESP" | "EXCEL" | "FMT" | "HDAT" | "IMAGE" | "JMP" | "LASR" | "PARQUET" | "SOUND" | "SPSS" | "VIDEO" | "XLS", fileType-specific-parameters}, * name="table-name", orderBy={{ format="string", formattedLength=integer, label="string", * name="variable-name", nfd=integer, nfl=integer }, {...}}, singlePass=TRUE | FALSE, vars={{ format="string", formattedLength=integer, label="string", * name="variable-name", nfd=integer, nfl=integer }, {...}}, where="where-expression" }, * xVarNames={"string-1" <, "string-2", ...>};
Settings
ParameterDescription
casOutSpecifies the output table for the expected range values. This table will contain the calculated range metrics.
dttmNameSpecifies the name of the datetime variable in the input time series table. This variable is used to order the time series.
expectedRangeWindowLengthSpecifies the window length (number of observations) used for the expected range calculation. Must be an integer greater than or equal to 1.
rangeWindowLengthSpecifies the window length (number of observations) used for the range calculation. Must be an integer greater than or equal to 1.
timeSeriesTableSpecifies the input CAS table containing the time series data to be analyzed.
xVarNamesSpecifies one or more independent variables (input series) for which the expected range will be computed.
Data Preparation View data prep sheet
Creation of Time Series Data

Generates a sample time series dataset with a date variable and a value variable to be used for range analysis.

Copied!
1 
2DATA mycas.sample_ts;
3DO i = 1 to 100;
4date = intnx('day', '01JAN2020'd, i-1);
5value = 100 + rannor(123)*10;
6OUTPUT;
7END;
8FORMAT date date9.;
9 
10RUN;
11 

Examples

Calculates the expected range for the 'value' variable using a window length of 5 for both range and expected range.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3timeFilters.expectedRange / timeSeriesTable={name="sample_ts"} dttmName="date" xVarNames={"value"} rangeWindowLength=5 expectedRangeWindowLength=5 casOut={name="range_results", replace=true};
4 
5RUN;
6 
Result :
Generates an output table 'range_results' containing the original data along with the computed range and expected range columns for the 'value' variable.

Performs the expected range calculation on a grouped time series (if groups existed), specifying different window lengths and outputting to a promoted table.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3timeFilters.expectedRange / timeSeriesTable={name="sample_ts", groupBy={"i"}} dttmName="date" xVarNames={"value"} rangeWindowLength=10 expectedRangeWindowLength=20 casOut={name="detailed_range_results", replace=true, promote=true};
4 
5RUN;
6 
Result :
Produces a promoted CAS table 'detailed_range_results' with range statistics calculated over a 10-period window and expected range over a 20-period window.

FAQ

What is the primary function of the expectedRange action in the timeFilters action set?
Which parameter is used to specify the input data for the expectedRange action?
How do I define the datetime variable for the analysis?
What is the purpose of the 'rangeWindowLength' parameter?
How can I specify the independent variables to be analyzed?
Is it possible to save the results of the expectedRange action to a CAS table?
What is the 'expectedRangeWindowLength' parameter used for?