you may need to use prxnext. prxparse('/(ProviderName:\s+[a-zA-z ]+?;)/') indicates providers name folowed by space and words and till the ; prxnext capture position and length wherever you have this pattern. by doing substr(prov_info, position+13, length-13, we can remove ProviderName:
data have;
Prov_Info ="ProviderName: Spine and Pain Center of Whatchamikola;
IDN: 2345678901; IsGroup: No;,
ProviderName: Happy Toes; IDN: 3456789012; IsGroup: No;,
ProviderName: IDN: 3456789012; IsGroup: Yes;,
ProviderName: Bright Smiles of AZ; IDN: 1234567890 IsGroup: Yes;, ";
run;
data want;
length val patternid $200.;
set have;
start = 1;
stop = length(prov_info);
re = prxparse('/(ProviderName:\s+[a-zA-z ]+?;)/');
set have;
call prxnext(re, start, stop, trim(prov_info), position, length);
do while (position > 0);
val = substr(prov_info, position+13, length-13);
patternID = catx(" ", patternid, val);
call prxnext(re, start, stop, trim(prov_info), position, length);
end;
drop re start stop position length val;
run;
proc print data=want;
run;
... View more