In reply to Leonid Batkhan.

I have run this code and stored this function so I can now use it if needed. Thank you.

One concern:

data class;
set sashelp.class;
nname=trims('b',name,' ',' ');
run;

This works, but the new variable nname has length 32767. It's easy to add a LENGTH statement in the DATA step to prevent this from happening, but many people might not realize this extremely long length does result and obviously that's going to chew up a lot of space.