Calcite | Level 5

## Stationarity

Dear community

I have a monthly time serire data and i want test the stationarity of this serie.

Can one give me any suggestion!!

regards

4 REPLIES 4
SAS Employee

## Re: Stationarity

If you use SAS Viya, you can use TSA.STATIONARITYTEST function. See the example below (I copied from documentation), which uses sashelp.air data set in CAS:

```proc tsmodel data=mycas.air outscalar=mycas.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;
```
You can get more information regarding the TSA package and this function at

Hope it helps!
Calcite | Level 5

## Re: Stationarity

Hi

I don't use SAS viya.

I used the ADF and KPSS test.

Based on their output the time serie has a trend.

But when i want remove the trend using proc reg

Proc reg data=database;

model y= T;

run;

T is the date variable from Jan 2015 to Dec 2018.

data database;

set database;

T

TY= y-B*T;

run;

The TY which i created has no value.

I don't know how i can remove the trend of my variable.

Obsidian | Level 7

## Re: Stationarity

There are two types of non-Stationarity. The first is stochastic non-Stationarity (which I think is what one uses the ADF and KPSS test for). This is dealt with by differencing.

The second type is a deterministic non-Stationarity. This is commonly dealt with by specifying a quadratic or cubic time variable.

You have to know which type of non-Stationarity you have and specify the right correction.
Calcite | Level 5

## Re: Stationarity

Hi noetsi

I have  a deterministic non-Stationarity.

Should I regress my variable on the date (date is from Jan 2015 to Dec 2018) variable like that

proc reg data=data;

model Y=date;

run;

Discussion stats
• 4 replies
• 507 views
• 0 likes
• 3 in conversation