@Specter wrote:
Hi,
i have a Problem with my Code.
%macro print2;
%let x = %test% %test2%;
%let myvar=%str('%');
%local i next_name;
%do i=1 %to %sysfunc(countw(&x));
%let next_name = %scan(&x, &i);
%put &next_name;
%end;
%mend print2;
%print2;
the ouput is :
test
test2
but i Need this Output
%test%
%test2%
You need to quote the value of X. This will suppress the first group of invocation notes in the log.
WARNING: Apparent invocation of macro TEST not resolved. Then as mentioned by @Astounding use QSCAN with blank as delimiter, this will suppress the other invocation notes and return the proper values.
55
56 %macro print2;
57 %let x = %nrstr(%%test%% %%test2%%);
58
59 %local i next_name;
60 %do i=1 %to %sysfunc(countw(&x));
61 %let next_name = %qscan(&x,&i,%str( ));
62 %put &next_name;
63 %end;
64 %mend print2;
65
66 %print2;
%test%
%test2%
67
68
... View more