OK I read few topics on that one and still am stumped - apologies in advance if it's obvious for some of you. The difference in my code is that I try create a macro variables iteratively. I think I manage to do that but the dreaded %put tells me otherwise. I tried several things around %global but nothing really works (I tried symput instead of symputx). My code is simple. %macro ALLx ;
%let j=1 ;
%let k=2 ; run ;
%do i = 1 %to &ntrait. ;
data _NULL_ ;
set f2 ;
if par1 = &j. ;
call symputx("x&i.",est,g) ; run ;
%let j = %eval(&j.+&k.) ; run ;
%let k= %eval(&k.+1) ; run ;
%put &i. &j. &k. &&x&i. ; run ; quit ;
%end ;
%mend ALLx ;
%ALLx ;
%put &x1. &x2. &x3. &x4. &x5. &x6. ; run the log gives me hope - I only give you the last round of iteration. [...]
MLOGIC(ALLX): %LET (variable name is J)
SYMBOLGEN: Macro variable J resolves to 21
SYMBOLGEN: Macro variable K resolves to 7
MPRINT(ALLX): run ;
MLOGIC(ALLX): %LET (variable name is K)
SYMBOLGEN: Macro variable K resolves to 7
MPRINT(ALLX): run ;
MLOGIC(ALLX): %PUT &i. &j. &k. &&x&i.
SYMBOLGEN: Macro variable I resolves to 6
SYMBOLGEN: Macro variable J resolves to 28
SYMBOLGEN: Macro variable K resolves to 8
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable I resolves to 6
SYMBOLGEN: Macro variable X6 resolves to 6.2460106
6 28 8 6.2460106
MPRINT(ALLX): run ;
MPRINT(ALLX): quit ;
MLOGIC(ALLX): %DO loop index variable I is now 7; loop will not iterate again.
MLOGIC(ALLX): Ending execution. I can see that variable X6 is resolve to 6.2460106 - great. but the %put statement wipes my smile away as I got the WARNING: Apparent ...not resolved. anyway if any of you have hints, please forward. cheers Th.
... View more