BookmarkSubscribeRSS Feed
Quartz | Level 8

Hello SAS time Series experts,

   Following code gives me error about insufficient number observations as minimum is 31 but I only have 29. Unfortunately I will have to wait months to get additional historical data points Are there any additional options to force SAS to run this test with 28 or 29 observations?


/*cointegrating test (Johansen)*/
title1 "Cointegration Test";
proc varmax data=testdata;
model y x1 / dftest cointtest=(johansen);

Get this error:





SAS Employee



There is minimum number of observations requirement when the automatic tentative order selection routine is used. It is in this routine that the procedure checks to see if the data set includes the recommended minimum number of observations needed for model selection.  This check is based on the number of response variables specified in the model and the range of the order of the VARMA models to consider.  Because you did not specify P = or Q = option in the MODEL statement, the procedure uses the automatic tentative order selection routine to select the AR and MA orders, as shown in the note just before the error message you observed:


NOTE: Since both the autoregressive and moving average orders are not specified, the AR and MA
orders are selected by a minimum information criterion.
ERROR: Insufficient number of observations. After any differencing is performed, there are xx
observations and a minimum of xx are required.


If you do not have any more observations available than what you currently have, then you may avoid this error by explicitly specifying P = and/or Q = option in the MODEL statement rather than having the procedure choose the AR and MA orders automatically using the automatic tentative order selection routine. If you do not know the appropriate AR and/or MA order to specify for your model, then you may consider running each of the candidate models you want to consider separately, and compare the Information Criteria and Model Diagnostics across the models yourself in order to select the appropriate AR and MA orders. Please note that 31 observations for an VARMA model is really not a big sample size requirement, so you may want to consider only low order models. 


I hope this helps. 

Quartz | Level 8

Thanks when I set p=1 it works for most of the models I'm testing. But does not work for one and I get the following error. How can I fix this?


title1 "Cointegration Test";
proc varmax data=datasetname;
model y x2 / dftest cointtest=(johansen) p=1;


ERROR: The matrix is not positive definite when the cointegrated job is processed. The VARMAX procedure stopped processing further

SAS Employee

The error message indicates that non-positive definite matrix is encountered during the cointegrated job process. Such problem is data dependent. In order to further investigate it will be helpful if you can provide your .sas7bdat file which enters your PROC VARMAX step. If you cannot share your data set on the communities, you may open a Technical Support track and send in your data set via the Technical Support track:



Calcite | Level 5
Hi, how would you run the candidate models separately?
Would this just involve running the VARMAX procedure with different orders of p=?



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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
  • 4 replies
  • 1 like
  • 3 in conversation