How to assign a value to a macro in datastep in a loop SAS -
so trying this:
data temp1; set temp; i=1 10; call symput("var1", i); end; array x(*) x_&var1 x_&var10; .................... run;
i trying assign value of (1 10) macro variable var1. in same datastep, use var1 index arrays.
you can change call symput
this:
call symput(compress('var'||put(i,8.)), put(i,8.));
i wrapped put()
around second argument symput
clean log message.
(this seem weird pattern though. if you're dynamically creating lot of macro variables, might able rethink overall strategy , come simpler.)
edit: nate has point sas variable created symput
not being usable inside same datastep. if still want go solution, can move symput
loop _null_
datastep before "temp1" step.
Comments
Post a Comment