Hi,
I have created a little macro that does the following action :
Add quote for each element of the list and add a delimiter. The delimiter to add is specified through &outdelim. I would like also allow the user to specify the delimiter default that is in the input list.
After testing I got a strange issue when I specify that the input delimiter &indelim is blank. I creates an error. How to communicate to my macro that the delimiter is blank ?
%macro splitw(varsplit=,
indel=,
outdel=,
outvar=)
/DES="split word ";
%global outsplit;
%put %scan(&varsplit.,1,&indel.);
/* In this version we assume that the delimitor is blank for COUNTW()*/
%let cw=%sysfunc(countw(&varsplit));
%let st=;
%do i=1 %to %eval(&cw.-1);
%let s&i= %sysfunc(quote(%scan(&varsplit.,&i.,&indel.))) &outdel.;
%let st= &st. &&s&i. ;
%end;
%let s&cw= %sysfunc(quote(%scan(&varsplit.,&cw,&indel.)));
%let &outvar=&st.&&s&cw.;
%put &outsplit;
%mend splitw;
%splitw(varsplit=(ALBPHA BETA),indel=%str( ),outdel=%str(,),outvar=outsplit);
Any clue ?
Regards,
saskap
... View more