Hi guys. This is my code, I want to substring the "word" value but the first part of the code cannot work, seems like word resolve into:123456789'. But I don't understand the mechanism behind it? In the second part, I got the result, but string='5', why it's not '6' when I use the sixth position inside the %substr function? /******************** first part***********************/ %macro createdata(n=,word=);
%do i=1 %to &n;
data data&i;
%if &i>5 %then string=%substr(&word,6);
run;
%end;
%mend;
%createdata(n=10,word='123456789'); /********************second part***********************/
%macro createdata(n=,word=);
%do i=1 %to &n;
data data&i;
%if &i>5 %then string=%substr(&word,6,1);;
run;
%end;
%mend;
%createdata(n=10,word='123456789');
... View more