PerlIsGood
Programmer
Having some problems building a macro using a list of variables that is later used in a scan loop. Here is the following bits of code:
It's erroring out on the 'do while(scan' piece. I need to loop through the list-of-lists given in the macro variable. Perhaps there's a better way to cycle through that macro variable?
Notorious P.I.G.
Code:
---in macro shell
%let globlistkeep=
tot_bal1-tot_bal25
tot_credit1-tot_credit25;
---in separate included sas program in a data step
%let f = 1;
do while (scan(&globlistkeep,&f,' ') ne );
%let fvar = %scan(&globlistkeep,&f,' ');
array fx {*} &fvar;
do i=1 to &mnths;
fx{i}=fx{i}*-1;
end;
if
%let f = eval(&f+1);
end;
---log excerpt of error
MPRINT(BUILDHUB): * ----- MERGE IN CREDITMIS AND GLOBESTAR DATA ----- ;
MPRINT(BUILDHUB): * GLOBESTAR data;
MPRINT(BUILDHUB): data globdata(keep=acct11 dtopened tdbamt1-tdbamt24);
MPRINT(BUILDHUB): set
MPRINT(XUNC): _c_1.italy_globestar
MPRINT(BUILDHUB): ;
MPRINT(BUILDHUB): array tenure {*} tenur1-tenur24;
MPRINT(BUILDHUB): do x=1 to 24;
MPRINT(BUILDHUB): if tenure{i} = 1 then tenurekeep=1;
MPRINT(BUILDHUB): else tenurekeep=0;
MPRINT(BUILDHUB): end;
2997 + do while (scan(&globlistkeep,&f,' ') ne );
_
_
_
22
22
22
MPRINT(BUILDHUB): do while (scan(tdbamt1-tdbamt24,1,' ') ne );
MPRINT(BUILDHUB): array fx {*} tdbamt1-tdbamt24;
MPRINT(BUILDHUB): do i=1 to 24;
MPRINT(BUILDHUB): fx{i}=fx{i}*-1;
MPRINT(BUILDHUB): end;
MPRINT(BUILDHUB): if end;
MPRINT(BUILDHUB): dto=put(dtopened,$8.);
WARNING: Variable dtopened has already been defined as numeric.
MPRINT(BUILDHUB): year=substr(dto,1,4);
MPRINT(BUILDHUB): if year in ('2005' '2006') and tenurekeep=1;
MPRINT(BUILDHUB): run;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
a missing value, bitstring, INPUT, PUT.
a missing value, bitstring, INPUT, PUT.
a missing value, bitstring, INPUT, PUT.
Notorious P.I.G.