Hi yy1234
Something like that:
data _null_;
infile datalines missover;
input String $50.;
put String=;
array StringPart {100} $100.;
i=1;
do while(scan(String,i,') /') ne '');
StringPart{i}=scan(String,i,') /');
StringPart{i}=compress(StringPart{i},'(');
put StringPart{i}=;
i+1;
end;
datalines;
(F1) 172/233
(M20) 141
(M279) 256
(F125) 9/87
M(603)90 F(666)10/170
M(850)84 F(832)9/358
;
You could also first pass the data set and determine the necessary number of array elements before reading the "words" into separate variables.
I've chosen 100 array elements.
What could work to do it more dynamic is: length() of string - length() of string after compression of all delimiters - and then keeping the max value of this difference (call symput).
Using this value (in macrovar) in array definition..... just an idea.
And yes: There would also be some Perl RegEx which could be helpful - but I think in your case they wouldn't provide a simpler solution.
Cheers
Patrick
... View more