BookmarkSubscribeRSS Feed
Quartz | Level 8

Dear all,


I would like to calculate the optimal lag length for a variable. I notice that it is possible by using Microfit as shown in this link (


I would like to know whether this calculation be done using SAS codes?


Thank you.



Super User
I searched it in sas documentation.
And find this at PROC AUTOREG .

provides a class of efficient unit root tests, because they reduce the size distortion and improve
the power compared with traditional unit root tests such as the augmented Dickey-Fuller and
Phillips-Perron tests. Two test statistics are reported with the ERS= suboption: the point optimal
test and the DF-GLS test, which are originally proposed in Elliott, Rothenberg, and Stock (1996).
Elliott, Rothenberg, and Stock suggest using the Schwarz Bayesian information criterion to select

    optimal lag length 

in the augmented Dickey-Fuller regression. The maximum lag length can
be specified by ERS=value. The minimum lag length is 3 and the default maximum lag length is
Six tests, namely MZ , MSB, MZt, the modified point optimal test, the point optimal test,
and the DF-GLS test, which are discussed in Ng and Perron (2001), are reported with the NP=
suboption. Ng and Perron suggest using the modified AIC to select the

 optimal lag length 

in the
augmented Dickey-Fuller regression by using GLS detrended data. The maximum lag length can
be specified by NP=value. The default maximum lag length is 8. The maximum lag length in the
ERS tests and Ng-Perron tests cannot exceed T =2
2, where T is the sample size.

Quartz | Level 8

Can anyone here to suggest/provide sample SAS program code for this purpose?


Thank you.




Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2 in conversation