Alternatively you could try the perl regular expression which will achieve the expected output from a single line code
data one;
input name $1-24;
newname=prxchange('s/^\w\s|\w$/ /',-1,strip(name));
cards;
BANGE RICHARD M
AARON J BOWLER
A IAN GILES
;
run;
... View more