程序如下:
%macro test1(arrv,gr);
data _null_;
array vars (*)$ &arrv. ;
call symputx ("dim_exposure", dim(vars));
do i=1 to dim(vars);
call symputx (cats ("exposure_",i),vname(vars(i)));
end;
run;
data t;
set t;
%do i=1 %to &dim_exposure;
if count (renal_diag, "&&exposure_&i")>0 then gr_nu= &gr. ;
%end;
run;
%mend test1;
%test1 (arrv=a11 b11.2 c11, gr=1);
错误如下:
40 a11 b11.2 c11
_____
22
201
WARNING: Apparent symbolic reference DIM_EXPOSURE not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
&dim_exposure
ERROR: The %TO value of the %DO I loop is invalid.
ERROR: The macro TEST1 will stop executing.
ERROR 22-322: Syntax error, expecting one of the following: a name, (, -, :, ;, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 201-322: The option is not recognized and will be ignored.
请教高人