Functions That Remove Blanks from Strings

There are times when you want to remove blanks from the beginning or end of a character string. The two functions LEFT and RIGHT merely shift the characters to the beginning or the end of the string, respectively. The TRIM, TRIMN, and STRIP functions are useful when you want to concatenate strings (although the concatenation functions will do this for you).

LEFT and RIGHT

These two functions left- or right-align text. Remember that the length of a character variable will not change when you use these two functions. If there are leading blanks, the LEFT function will shift the first non-blank character to the first position and move the extra blanks to the end; if there are trailing blanks, the RIGHT ...

Get SAS Functions by Example, Second Edition, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.