Hello, there: I would like to generate macro variable that includes same strings repeatedly, and that has name I want. I have 3 ideas (for more details, please see below), and like Pattern 3, I would like to generate macro variable with name I want in same step (in MACRO setting). But after submitting Pattern 3 code, I get WARNING. I do not know why and how to resolve this problem. If you have any ideas, please let me know. Any ideas would be welcome. Thank you in advance. ***** Pattern 1 ; In this pattern, I have to define null macro variable first. * Pattern 1: Define MACRO VARIABLEs in advance ;
***** First, you have to define MACRO VARIABLEs you want ;
%let re5=;
***** Second, specify word you want to repeat ;
%let t=WORD;
***** MACRO Setting ;
%macro re(max=);
data re(drop=i);
length re $2000.;
array ar1(*) $ re1-re&max.;
do i=1 to dim(ar1);
ar1(i)='&t';
end;
re=catx(" ", of re1-re&max.);
run;
proc sql noprint;
select re into :re&max.
from work.re
;
quit;
%mend re;
***** Finally, generate MACRO VARIABLE & check content ;
%re(max=5)
%put &re5.;
***** If you don't define MACRO VARIABLEs in advance, get WARNING ;
%re(max=100)
%put &re100.; ***** Pattern 2 ; In this pattern, after submitting MACRO, I have to define macro variable with name I want. * Pattern 2: After setting MACRO, Store MACRO VARIABLEs with name you want ;
***** First, specify word you want to repeat ;
%let t=WORD;
***** MACRO Setting ;
%macro re(max=);
data re(drop=i);
length re $2000.;
array ar1(*) $ re1-re&max.;
do i=1 to dim(ar1);
ar1(i)='&t';
end;
re=catx(" ", of re1-re&max.);
run;
%mend re;
***** Second, submit your MACRO ;
%re(max=10)
***** Finally, generate MACRO VARIABLE with name you want & check ;
proc sql noprint;
select re into :re10
from work.re
;
quit;
%put &re10.; ***** Pattern 3 ; In this pattern, I think I can generate macro variable with name I want, but this code does not work..... * Pattern 3: In same step (MACRO Setting), generate MACRO VARIABLE with name you want ;
***** NOTE: There're some problems in this method ;
***** First, specify word you want to repeat ;
%let t=WORD;
***** MACRO Setting ;
%macro re(max=);
data re(drop=i);
length re $2000.;
array ar1(*) $ re1-re&max.;
do i=1 to dim(ar1);
ar1(i)='&t';
end;
re=catx(" ", of re1-re&max.);
run;
********** At here, in MACRO Setting, I want to generate MACRO VARIABLE with name I want, but something is wrong..... ;
data _null_;
set re;
call symputx("re&max.", re);
run;
%mend re;
***** Finally, generate MACRO VARIABLE & check content ;
%re(max=15)
%put &re15.; * <----------Submit WARNING ?????????? ;
... View more