Create SAS macro to create a macro variable -


i have created sas macro, macro a, takes in variable name , returns transformed versions of name i.e. if run %a(asdf) out asdf_log asdf_exp asdf_10. want write macro, macro b, takes output first macro , appends new macro variable.

%macro b(varlist, outputname);     %let &outputname =          %a(var1);         %a(var2);         ; %mend 

is want do, except doesn't compile. not sure if possible in sas. further complication, input macro b list of variable want run macro , append 1 long list of variable names.

why? because have macro runs on list of variables , want run on transformed variable list.

example: have %let varlist = x y; , want output x_log x_exp x_10 y_log y_exp y_10. want 2 macros one, macro a, returns transformed variables names:

%macro a(var);     &var._log     &var._exp     &var._10 %mend 

i can't second macro (b written above) work properly.

so if inner macro returning characters, doesn't generate non macro statements, why not make outer 1 work same way?

%macro inner(x);   &x._log &x._exp &x._10 %mend;  %macro outer(list); %local i; %do i=1 %to %sysfunc(countw(&list));  %inner(%scan(&list,&i)) %end; %mend outer;  %let want=%outer(x y z); 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -