Skip to content

Assignment Time Series Analysis Sas

The Time Data Preparation task analyzes the variable assigned to the time ID role to detect the time interval of the data. SAS assumes that all the values in the time ID variable are either date or datetime values and distinguishes between the values by their magnitude. This assumption fails if you have dates that extend beyond July 21, 2196, or datetimes before January 1, 1960.

For many businesses, their time series data is equally spaced, or any two consecutive indices have the same difference between the time intervals. The following table shows an equally spaced time series with a one-year interval.

Year

Number of Sales

2012

42,100

2013

45,000

2014

47,000

2015

50,000

If the time interval cannot be detected from the variable that you assign, then you need to specify the interval and season length. For example, the following table shows an unequally spaced time series.

Year

Number of Sales

2009

32,100

2010

45,000

2014

47,000

2015

50,000

Often the time interval cannot be detected with transactional data (time-stamped data that is recorded at no particular frequency). If this is the case, the task accumulates the data into observations that correspond to the interval that you specify. For nontransactional data, you might need to specify the interval and season length if there are numerous gaps (missing values) in the data. In this case, the task supplies the missing values. A validation routine checks the values of the time ID to determine whether they are spaced according to the interval that you specified.

The interval determines the frequency of the output. You can modify the time interval. You can change the interval from a higher frequency to a lower frequency or from a lower frequency to a higher frequency. Time intervals are specified in SAS by using character strings. Each of these strings is formed according to a set of rules that enables you to create an almost infinite set of attributes. For each time interval, you can specify the type (such as monthly or weekly), a multiplier, and a shift (the offset for the interval). You can specify a greater time interval than that found in the input data. A smaller interval should not be used, because a small interval generates a large number of observations.

Seasonal cycle length specifies the length of a season. This value is populated automatically if the task can determine the season length from the time ID variable. However, you can specify a season length other than the default if you want to model a cycle in the data. For example, your data might contain a 13-week cycle, so you need to specify a 13-week season length.

Here is the syntax for an interval:

name<multipler><.shift>

The examples in the following table show how the values that you specify for the interval, season length, multiplier, and shift work together.

Interval Name (in SAS Code Format)

Default

Shift Period

Example

YEARm.s

January 1

Months

YEAR2.7 specifies an interval of every two years. Because the value for the shift is 7, the first month in the year is July.

QTRm.s

January 1

April 1

July 1

October 1

Months

QTR3.2 specifies three-month intervals starting on April 1, July 1, October 1, and January 1.

MONTHm.s

First of each

month

Months

MONTH2.2 specifies February–March, April–May, June–July, August–September, October–November, and December–January of the following year.

WEEKm.s

Each Sunday

Days

(1=Sunday . . .

7=Saturday)

WEEK6.3 specifies six-week intervals starting on Tuesdays.

DAYm.s

Each day

Days

DAY3 specifies three-day intervals starting on Sunday.

Here is an explanation of each of the user-supplied values:

name

is the name of the interval.

multipler

specifies the multiplier of the interval. This value can be any positive number. By default, the multiplier is 1. For example, YEAR2 indicates a two-year interval.

.shift

specifies the starting point for the interval. By default, this value is one. A value greater than 1 shifts the start to a later point within the interval. The unit for the shift depends on the interval. For example, YEAR.4 specifies a shift of four months, so the year is from April 1 through March 31 of the following year.

Time Series Exploration Task

About the Time Series Exploration Task

The Time Series Exploration task creates graphs and statistics that enable you to view and analyze your time series data.

Example: Exploring the SASHELP.PRICEDATA Data Set

  1. In the Tasks section, expand the Forecasting folder and double-click Time Series Exploration. The user interface for the Time Series Exploration task opens.
  2. On the Data tab, select the SASHELP.PRICEDATAdata set.
  3. Assign columns to these roles and specify these options:
    1. To the Dependent variable role, assign the sale variable.
    2. Expand the Additional Roles heading. To the Time ID role, assign the date variable. From the Interval drop-down list, select Quarter.
    3. Under the Roles heading, locate the Transformations table. For the sale variable, find the Accumulation drop-down list, and select Sum as the accumulation method.
  4. Click the Analyses tab, and select these series plots:
    • To run the task, click .
    The first part of the results describes the input data set. This information shows the name and interval of the time ID variable and information about the dependent variable.
    The time series plot suggests that there is a cyclical nature to sales for this product.
    The histogram shows the distribution of sales for the series. Both a normal distribution and a kernel distribution are overlaid on the histogram.
    The seasonal cycle plot shows that sales peak in Quarter 2 and are the lowest in Quarter 4.

    Assigning Data to Roles

    To run the Time Series Exploration task, you must assign a column to the Dependent variable role.
    specifies any explanatory, input, predictor, or causal factor variables. You can assign only numeric variables to this role.
    specifies the column that contains the time ID values.
    specifies the multiplier for the time interval. By default, the multiplier is 1. This value cannot be negative.
    specifies the shift for the time interval. By default, the shift is 1. This value cannot be negative.
    specifies the seasonality of the time interval. The default value depends on the time interval.
    enables you to specify the seasonality of the data when you do not assign a time ID variable.
    lists the variable or variables that you want to use as the classification (BY) variables.

    Setting the Analyses Options

    You can include these series plots in your results:
    You can include these statistics in your results:
    Perform autocorrelation analysis
    specifies the plots to display in the results. By default, the results show the autocorrelation analysis panel. However, you can select whether to include these plots in the results as well:
    specifies the lag values. By default, the number of lags is 0.
    Cross-Correlation Analysis
    Note: To perform a cross-correlation analysis, you must assign a variable to the Independent variables role.
    Perform cross-correlation analysis
    Note: To perform a decomposition analysis, the seasonal cycle length must be greater than 1.
    Perform decomposition analysis
    specifies the plots to include in the results. By default, the decomposition panel is included. You can choose to include these plots as well:
    Spectral Density Analysis
    Spectral density estimate plot
    specifies the minimum period to include in the spectral density plot. This value must be an integer greater than or equal to 0 and less than or equal to 32,767.
    Adjust the series by its mean prior to the analysis
    specifies whether the series should be adjusted by its mean before performing the Fourier decomposition.
    specifies how the smoothing function is interpreted. You can choose from these options:
    • Frequency smooths the periodogram ordinates. This is the default.
    specifies the kernel function to use in the analysis. By default, no kernel function is specified. You can choose from these options:
    • Quadratic spectral kernel
    specifies the exponent for the kernel function.
    Perform augmented Dickey-Fuller test
    specifies whether to perform an augmented Dickey-Fuller test.
    specifies the augmenting order for the Dickey-Fuller test. This value must be an integer greater than or equal to 0 and less than or equal to 1,000.
    Copyright © SAS Institute Inc. All rights reserved.