Tom,
I think PRX is the best choice.
If data like the following,your code does not work !
data have;
infile cards;
input string &:$50.;
cards;
Influenza Invalid,FLU-22 Invalid
Influenza Invalid(20),FLU-22 Invalid(2999)
Influenza Canceled(77),FLU-22 Canceled(77)
Influenza Negative,FLU-22 Positive
(Influenza)
;
run;
data want;
set have;
length string2 string3 $80.;
do i=1 by 2 to countw(string,'()');
string2=cats(string2,scan(string,i,'()'));
end;
string3 = prxchange('s/\(.*?\)//', -1, string);
drop i;
run;
... View more