Note: All text operators are case
sensitive.
Note: Text operators are not supported
for aggregated items.
FindChar
finds the position of a
character or any of a set of
characters within a
text string. The position of the first match is returned as a
numeric value. If no matches are found, then 0 is returned. The first
input string specifies the value to search within. The second input
string specifies the list of characters to search for.
For example, FindChar('mystring', 'sz')
returns
3.
FindString
finds the position of a string within another string. The position of the first match
is returned as a numeric value. If no matches are found, then 0 is returned. The
first input string specifies the value to search within. The second input string specifies
the string
to search for.
For example, FindString('mystring', 'st')
returns
3.
GetLength
returns the length of an input string as a numeric value.
For example, GetLength('mystring')
returns
8.
GetWord
returns a word from an input string where the words are separated by spaces, periods,
or other
special characters. The first
parameter specifies the input string. The second parameter specifies the number of the word
to return where 1 is the first
word.
For example, GetWord('my
test string', 2)
returns test.
RemoveBlanks
removes space characters from the input string. The first parameter specifies the
input string. The second parameter specifies which space characters to remove. Select
one of the
following:
_All_
removes all spaces from the string.
_Leading_
removes spaces at the beginning of the string.
_LeadingAndTrailing_
removes spaces at the beginning and end of the string.
_Trailing_
removes spaces at the end of the string.
For example, RemoveBlanks('my
test string', '_ALL_')
returns myteststring.
RemoveChars
removes all instances of a set of characters from the input string. The first parameter
specifies the input string. The second parameter specifies the list of characters
to remove.
For example, RemoveChars('my_test_string', '_')
returns myteststring.
RemoveWord
removes a word from an input string where the words are separated by spaces or special
characters. The first parameter specifies the input string. The second parameter specifies
the number of the word to remove where 1 is the first
word.
For example, RemoveWord('my
test string', 2)
returns my string.
Note: In addition to spaces, the
following characters are used as delimiters in the input string: .
< ( ) + & ! $ * ; ^ - / , % | ’
Replace
replaces a
substring within the input string with a replacement string. The first parameter specifies
the input string. The second parameter specifies the substring to replace.
The third parameter specifies the replacement string. The fourth parameter specifies
which instances of the substring to replace. Select one of the following:
_FIRST_
replaces the first
instance only.
_LAST_
replaces the last instance
only.
For example, Replace('my
test string test', 'test', 'new', '_ALL_')
returns my
new string new.
ReplaceWord
replaces a word from an input string where the words are separated by spaces, periods,
or other special characters. The first parameter specifies the input string. The second
parameter specifies the number of the word to replace where 1 is the
first word. The third parameter specifies the replacement string.
For example, ReplaceWord('my
test string', 2, 'new')
returns my
new string.
Reverse
reverses the order of the characters in the input string.
For example, Reverse('A
B C')
returns C B A.
Substring
returns a substring from the input string based on the position of the characters.
The first parameter specifies the input string. The second parameter specifies the
position of the first character to return. The third parameter specifies the number
of characters to return.
For example, Substring('my
test string', 4, 3)
returns tes.
Update
replaces a substring from the input string based on the position of the characters.
The first parameter specifies the input string. The second parameter specifies the
position of the first character to replace. The third parameter specifies the number
of characters to replace. The
fourth parameter specifies the replacement string.
For example, Update('my
test string', 4, 3, 'nex')
returns my
next string.
URLDecode
removes URL
encoding from the input string. URL encoding replaces some characters with a % character followed
by a two-digit hexadecimal code.
For example, URLDecode('support.sas.com%2Fmy%20string')
returns support.sas.com/my
string.
URLEncode
applies URL encoding to the input string. URL encoding replaces some characters with
a % character followed by a two-digit hexadecimal code.
For example, URLEncode('support.sas.com/my
string')
returns support.sas.com%2Fmy%20string.