Yes, this whole thing is most messy for no good reason at all, and needs (needed? maybe it's too late) a good clean up.
The data step behaves differently, and results are as expected. The SQL interpreter is the confused party here.
data T1;
length X Y1 Z1 $32000;
X=repeat('1234<zxcv> '||'090A'x,200);
Y1= prxchange("s/<.*?>|[\x08-\x0D]/ /", -1, htmldecode(htmldecode(X))) ;
Z1=compbl(prxchange("s/<.*?>|[\x08-\x0D]/ /", -1, htmldecode(htmldecode(X))));
run;
proc sql;
create table T2 as
select X
, prxchange("s/<.*?>|[\x08-\x0D]/ /", -1, htmldecode(htmldecode(X))) as Y2 length=32000
, compbl(prxchange("s/<.*?>|[\x08-\x0D]/ /", -1, htmldecode(htmldecode(X)))) as Z2 length=32000
from T1;
quit;
data ALL;
merge T1 T2;
LY1=length(Y1);
LY2=length(Y2);
LZ1=length(Z1);
LZ2=length(Z2);
putlog LY1= LY2= LZ1= LZ2= ;
run;
LY1=1604 LY2=1604 LZ1=1004 LZ2=124
... View more