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.
| Parameter | Description |
|---|---|
| casOut | Specifies the output table for the expected range values. This table will contain the calculated range metrics. |
| dttmName | Specifies the name of the datetime variable in the input time series table. This variable is used to order the time series. |
| expectedRangeWindowLength | Specifies the window length (number of observations) used for the expected range calculation. Must be an integer greater than or equal to 1. |
| rangeWindowLength | Specifies the window length (number of observations) used for the range calculation. Must be an integer greater than or equal to 1. |
| timeSeriesTable | Specifies the input CAS table containing the time series data to be analyzed. |
| xVarNames | Specifies one or more independent variables (input series) for which the expected range will be computed. |
Generates a sample time series dataset with a date variable and a value variable to be used for range analysis.
| 1 | |
| 2 | DATA mycas.sample_ts; |
| 3 | DO i = 1 to 100; |
| 4 | date = intnx('day', '01JAN2020'd, i-1); |
| 5 | value = 100 + rannor(123)*10; |
| 6 | OUTPUT; |
| 7 | END; |
| 8 | FORMAT date date9.; |
| 9 | |
| 10 | RUN; |
| 11 |
Calculates the expected range for the 'value' variable using a window length of 5 for both range and expected range.
| 1 | |
| 2 | PROC CAS; |
| 3 | timeFilters.expectedRange / timeSeriesTable={name="sample_ts"} dttmName="date" xVarNames={"value"} rangeWindowLength=5 expectedRangeWindowLength=5 casOut={name="range_results", replace=true}; |
| 4 | |
| 5 | RUN; |
| 6 |
Performs the expected range calculation on a grouped time series (if groups existed), specifying different window lengths and outputting to a promoted table.
| 1 | |
| 2 | PROC CAS; |
| 3 | timeFilters.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 | |
| 5 | RUN; |
| 6 |