Hi all,
I have a request to create variables in a dataset depends on the number of words a particular string has. I came with this code, but its not working.
For. Ex. The string "name" has 5 words, so my dataset one should have 5 variables starting with word1 till word5 containing the corresponding words.
%macro split (name=);
data one;
%let i=1;
j='x';
%do %while (j ne ' ');
word&i=%scan(&name,&i,' ');
j=word&i.;
output;
%let i=%eval (&i. + 1);
j=%scan(&name,&i,' ');
%end;
run;
%mend split;
%split (name='sas is an analytical language');
What may be the error in this code?
... View more