Time Series Analysis Package

STATIONARITYTEST Method

  • rc = TSA.STATIONARITYTEST (y, <dif>, <d>, <p>, <'type'>, <pvalue>);

The STATIONARITYTEST function tests for stationarity of a univariate time series.

Required Arguments

You must specify the following argument:

y

specifies the times series array to test.

Optional Arguments

You can also specify the following arguments, separated by commas. If you want to use a default value for any of these arguments, enter a space for it.

dif

specifies an array of positive integers or a positive integer that is used for differencing. The default value is 0.

d

specifies the order of unit root (d = 1, …, 12). If the type is SSM, then d = 1. The default value is 1.

p

specifies the autoregressive order, where p must be a nonnegative integer. The default value is 5.

'type'

specifies the type of test statistic used.

You can specify the following values within single quotation marks:

SSM

specifies the studentized test statistic for the single mean (intercept) case.

STR

specifies the studentized test statistic for the deterministic time trend case.

SZM

specifies the studentized test statistic for the zero mean (no intercept) case. This value is allowed only when d has a value of 1.

The default value of type is SZM.

Returned Values

The STATIONARITYTEST function returns the following values:

rc

returns one of the following scalar return codes:

rc Termination Reason
0 Time series is stationary with the default significance level of 0.05
1 Time series is not stationary with the default significance level of 0.05
< 0 Computational failure

Optional Returned Values

You can also specify the following arguments, separated by commas, to request additional returned values. If you do not want the value to be returned, enter a space for it.

pvalue

returns the probability value associated with the test.

Example

This example uses the TSMODEL procedure to test the stationarity on the time series array Air:

proc tsmodel data=mylib.air outscalar=mylib.outscalars;
   id date interval=month;
   var air;
   outscalars stationary1 stationary2;
   require tsa;
   submit;
   declare object TSA(tsa);
   stationary1=1; stationary2=1;
   rc = TSA.STATIONARITYTEST(air,,,,,pvalue);
   *test with the default significant level=0.05;
   if rc =1 then stationary1 = 0;
   *test with significant level = 0.1;
   if pvalue > 0.1 then stationary2 = 0;
   endsubmit;
run;
Last updated: July 09, 2026