Learner,
Just in case you'd prefer not to leave SAS base you could use the following. It generates the macro variables and displays their values in the log. I haven't fully tested it but it should be good for any number of words in the string. Of course you can replace the TRIM/LEFT functions with the appropriate version 9 function.
data a;
string = 'base macros sql advance';
i=1;
DO UNTIL(SCAN(string,i)='');
call symput('VAR'!!put(i,3. -L),SCAN(string,i));
i+1;
END;
DO j = 1 to (i-1);
x = symget('var'!!put(j,3.-l));
putv = 'var'!!TRIM(put(j,3.-l))!!'='!!TRIM(LEFT(x));
put putv;
END;
RUN;
Regards,
BPD
... View more