The following prog code runs fine but when i write it into a macro its giving me an error :
(Prog code)
data macm;
i=1;
do while((scan("&dsnames",i))^= "");
dsname= scan("&dsnames",i);
i=(i+1);
output;
end;
run;
pog code converted in to a macro.
options mprint symbolgen mlogic;
%macro loop;
%let i= 1;
%do %while ((%scan("&dsnames", &i))^= "");
%let dsname = %scan("&dsnames", &i);
%let i =%eval( &i + 1);
%output;
%end;
%mend;
%loop;
Errors received are -
MLOGIC(LOOP): Beginning execution.
MLOGIC(LOOP): %LET (variable name is I)
SYMBOLGEN: Macro variable DSNAMES resolves to ADAE,ADEF,ADLB,ADSL,ADTTE,ADXP
SYMBOLGEN: Macro variable I resolves to 1
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: (%scan("&dsnames", &i))^= ""
ERROR: The condition in the %DO %WHILE loop, (%scan("&dsnames", &i))^= "", yielded an invalid or missing value, . The macro will stop executing.
ERROR: The macro LOOP will stop executing.
MLOGIC(LOOP): Ending execution.
33