Hi @kalbo
Just check if the string is changed, i.e. s not equal to s2. The following code only outputs incorrect strings, but the comparison result could be assigned to an Error variable instead.
data a;
s = 'DOMAIN , LBNAM, LBDAT'; output;
s = 'DOMAIN;LBNAM;LBDAT'; output;
s = 'DOMAIN,,LBNAM, LBDAT'; output;
s = 'DOMAIN LBNAM LBDAT'; output;
s = 'DOMAIN, LBNAM, LBDAT'; output;
run;
data b (drop=s2); set a;
s2 = prxchange('s/(\w*)(\W*)(\w+)/$1, $3/',-1,trim(s));
if s ne s2 then output;
run;
... View more