The problem occurs when I call the macro:
%VECM21(dsIn=sasdata3.midquotesfinal, model=mrnt_nprice mrnt_eprice, order=20, nImpulse=1500, PrintLevel=2);
What really strikes me - and I am sure it will be helpful in understanding the error - is that once "order" is set above 8 the program cannot run the code and gives me the error message I just told you before. So, for a value of order that is less than or equal to 8, the macro works perfectly. Below, I provide you the whole macro and thereafter the log-output that gives the error. Thank you a lot for your help!
Kyriacos
%macro VECM21(dsIn=sasdata3.midquotesfinal, model=, order=1, nImpulse=12, LRCoeffOut=LRCoeff,
CovOut=covInnovation, PrintLevel=2);
%do i=1 %to 10;
%let p&i = %scan(&model, &i);
%put &&p&i;
%if %length(&&p&i)=0 %then %goto done1;
%end;
%done1: %let nPrice=%eval(&i-1);
%put nPrice=&nPrice;
data shock;
length ShockedVariable $ 12.;
%do iShock=1 %to &nPrice;
ShockedVariable = "&&p&iShock";
%do j=1 %to &nPrice;
&&p&j = 0;
%end;
do i=1 to &order+1;
output;
end;
&&p&iShock = 1;
output;
%do j=1 %to &nPrice;
&&p&j = .;
%end;
do i=1 to &nImpulse;
output;
end;
%end;
run;
proc model data=&dsIn
%if &PrintLevel>=2 %then list;
;
* Define price differences and cointegration vectors;
%do i=1 %to &nPrice;
d&&p&i = dif( &&p&i );
%if &i>=2 %then %str(z&i = lag(&p1) - lag(&&p&i) - zmean&i;);
%end;
* Build equations for each price ;
%do i=1 %to &nPrice;
&&p&i = lag(&&p&i)
%do j=1 %to &nPrice;
%do k=1 %to ℴ
+ c_&&p&i.._&&p&j.._&k * lag&k(d&&p&j)
%end;
%* Error correction term.;
%if &j>=2 %then %str(+ g_&&p&i.._&j * z&j);
%end;
;
%end;
* estimate the model. ;
fit &model / covs out=sasdata3.mrntregression outactual outresid %if &PrintLevel=0 %then noprint;;
%if %length(&CovOut)>0 %then ods output covResiduals=&CovOut;;
run;
* set cointegration vector long run means to zero;
%do i=2 %to &nPrice;
zmean&i = 0;
%end;
solve / forecast data=shock out=pred printall;
by notsorted ShockedVariable;
run;
quit;
* at lrc, the programm picks up the very last value of the IRF, i.e. the LR cumulative coeff.
the LR coefficients are put but not in the row-col format we want them. the transpose procedure thereafter transposes
the (2x2) matrix lrc and puts it in the form we want as LRcoeff. ;
data lrc;
set pred;
if _lag_<&nImpulse then delete;
array vn(&nPrice) $;
%do i=1 %to &nPrice;
vn(&i) = "&&p&i";
%end;
keep ShockedVariable &model;
run;
proc transpose data=lrc out=&LRCoeffOut name=Variable;
id ShockedVariable;
run;
*this part is mine ;
data sasdata3.lrcoeff ;
set lrcoeff ;
output;
run;
%if &PrintLevel>=1 %then %do;
proc print data=&LRCoeffOut noobs;
title2 "VECM2. Long-run (cumulative) impact coefficients (dataset=&LRCoeffOut)";
run;
%end;
%exit:
run;
%mend VECM21;
The log output is:
7 %VECM21(dsIn=sasdata3.midquotesfinal, model=mrnt_nprice mrnt_eprice, order=20, nImpulse=1500, PrintLevel=2);
mrnt_nprice
mrnt_eprice
nPrice=2
NOTE: The data set WORK.SHOCK has 3044 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: At OLS Iteration 5 CONVERGE=0.001 Criteria Met.
NOTE: The data set WORK.COVINNOVATION has 2 observations and 4 variables.
NOTE: The data set SASDATA3.MRNTREGRESSION has 338976 observations and 5 variables.
ERROR: Invalid value for width specified - width out of range
ERROR: Invalid value for width specified - width out of range
NOTE: The data set WORK.PRED has 0 observations and 7 variables.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MODEL used (Total process time):
real time 12.60 seconds
cpu time 11.99 seconds
NOTE: There were 0 observations read from the data set WORK.PRED.
NOTE: The data set WORK.LRC has 0 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
NOTE: There were 0 observations read from the data set WORK.LRC.
NOTE: The data set WORK.LRCOEFF has 2 observations and 1 variables.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: There were 2 observations read from the data set WORK.LRCOEFF.
NOTE: The data set SASDATA3.LRCOEFF has 2 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
NOTE: There were 2 observations read from the data set WORK.LRCOEFF.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds