Removes blanks or specified characters from the beginning, the end, or both the beginning and end of a character string.
is one of the following:
removes the blanks or specified characters from the beginning of the character string.
removes the blanks or specified characters from the end of the character string.
removes the blanks or specified characters from both the beginning and the end of the character string.
Default | BOTH |
is a single character that is to be removed from the character string. The default character is a blank.
must resolve to a character string or character variable and is described in sql-expression.
xxabcxx
.
SAS stores the value with three blanks after the last x (for a total
length of 10). If you attempt to remove all the x characters with
btrim(both 'x' from z)then the result is
abcxx
because PROC SQL sees the trailing
characters as blanks, not the x character. In order to remove all
the x characters, use btrim(both 'x' from btrim(z))The inner BTRIM function removes the trailing blanks before passing the value to the outer BTRIM function.