Replaces segments of a character string with new text.
|source||a character string, or an expression that evaluates to a character string|
|pattern||a character string, or an expression that evaluates to a character string|
|replace||a character string, or an expression that evaluates to a character string|
Character string, consisting of source, with replace substituted for all occurrences of pattern.
Use $translate to substitute portions of source with replace. If source, pattern, or replace are not of a character data type, they are converted to a character data type before the function is applied.
If source is of data type ALPHA or VARALPHA, searches for pattern are case-insensitive; otherwise, searches for pattern are case-sensitive.
$translate(“the slow brown fox”,”slow”,”quick”)
Evaluates to “the quick brown fox”.
% translates Smith to Smythe
list all Employees where LastName = “Smith”\
format FirstName $translate(LastName,”ith”,”ythe”)
Translates occurrences of Smith to Smythe in the field LastName.