|
Hi, all
I use Macro to do loop computation, which involves the
dimension of an existing data set.
However, I cannot get it run, since there were messages as below:
PROC IMPORT DATAFILE = 'test.txt' OUT = TEST
DBMS = TAB REPLACE; RUN;
PROC SQL NOPRINT;
SELECT name INTO:num_list separated BY " "
FROM dictionary.columns
WHERE libname="WORK" AND memname="TEST" AND
TYPE = "num";
Quit;
%LET nef=DIM(&num_list);
%MACRO LaggedEF;
%local i;
%local j;
DATA LagedEF;
SET test;
nlag = 2;
ARRAY AT{*} &num_list;
ARRAY AT1{*} EF1-EF%eval(nlag*nef);
%DO i=1 %TO nef
AT1(&i) = AT(&i);
%END;
%DO j = 1 %TO nlag;
%DO i=1 %TO nef;
AT1(&j*nef+i) = lag(AT1((&j-1)*nef+&i));
%END;
%END;
RUN;
%MEND LaggedEF;
%LaggedEF;
ERROR: A character operand was found in the %EVAL function or %IF
condition where a numeric operand is required. The condition was:
nlag*nef
ERROR: Missing numeric suffix on a numbered variable list (EF1-EF).
WARNING: Defining an array with zero elements.
ERROR: The macro LAGGEDEF will stop executing.
RUN;
I think "nef" is already a numerical value before the macro definiton.
Why macro does not recognize it?
Please give me a hand on this.
Thanks for your point.
Fred
|