Help using Base SAS procedures

I dont understand this error message

Reply
N/A
Posts: 0

I dont understand this error message

guys, i am trying to run my code and i get the following error message:

ERROR: Invalid value for width specified - width out of range
ERROR: Invalid value for width specified - width out of range

What does it exactly mean? its strange really, I just made a minor modification on the code and now it cannot run it...

thanks!

Kyri
Super Contributor
Super Contributor
Posts: 3,174

Re: I dont understand this error message

You really do need to share the code that is generating the error. Suggest you also share any related code leading up to the error, especially if it is invoked within a macro or DATA step. The executing SAS code needs to be visible in the SAS log information you provide.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: I dont understand this error message

thanks for your prompt reply!

how shall I share the code? shall I just copy-paste here?

Kyri
Super Contributor
Super Contributor
Posts: 3,174

Re: I dont understand this error message

Reply to your post and paste code - that's the only supported method within this forum.
Super Contributor
Super Contributor
Posts: 3,174

Re: I dont understand this error message

More accurately - paste your SAS Log which should reveal your code and the error you are getting.
N/A
Posts: 0

Re: I dont understand this error message

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&iSmiley Wink;
%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
Super Contributor
Super Contributor
Posts: 3,174

Re: I dont understand this error message

Suggest you contact SAS Technical Support and open a tracking issue to report the error. You will also want to set the OPTIONS stmt below to get more SAS log output diagnostics for your macro execution:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN ;

Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 359

Re: I dont understand this error message

I would suggest running it with MPRINT on and watch that LAG function.
Ask a Question
Discussion stats
  • 7 replies
  • 178 views
  • 0 likes
  • 3 in conversation