Paige is asking the right questions. This is an odd thing to want to do. Are you reading in a table shell as data? That seems like a reasonable thing to do, and parsing the data to get the mathematical symbols is not a crazy idea, but storing the results in macro variables is probably not the best approach, depending on the big picture.
That said, you can do it in a DATA step, using COUNTW to find the number of works, and using SCAN to find each word. Then CALL SYMPUTX to create a macro variable for each word. Something like:
data _null_ ;
invalue="X/X(X%)" ;
do i=1 to countw(invalue,"X","mi") ;
call symputx(cats("_s",i),scan(invalue,i,"X","mi")) ;
end ;
run ;
%put _user_ ;
Typically I would want to keep this data in a data set, instead of storing it in macro variable, so I might do it like:
data want ;
invalue="X/X(X%)" ;
length symbol $8 ;
do i=1 to countw(invalue,"X","mi") ;
symbol=scan(invalue,i,"X","mi") ;
output ;
end ;
run ;
proc print data=want ;
run ;
... View more