KTRANSLATE Function

Replaces specific characters in a character expression.
Category: DBCS
Tip: Non-DBCS equivalent function is TRANSLATE in SAS Functions and CALL Routines: Reference.
See: KTRANSLATE Function under z/OS

Syntax

KTRANSLATE(source,to-1,from-1<,…to-n,from-n> )

Required Arguments

source
specifies the SAS expression that contains the original character value.
to
specifies the characters that you want KTRANSLATE to use as substitutes.
from
specifies the characters that you want KTRANSLATE to replace.
Interaction:Values of to and from correspond on a character-by-character basis; KTRANSLATE changes character one of from to character one of to, and so on. If to has fewer characters than from, KTRANSLATE changes the extra from characters to blanks. If to has more characters than from, KTRANSLATE ignores the extra to characters.
Note:You must have pairs of to and from arguments on some operating environments. On other operating environments, a segment of the collating sequence replaces null from arguments. See the SAS documentation for your operating environment for more information.

Details

See Internationalization Compatibility for SAS String Functions for restrictions and more information.
You can use KTRANSLATE to translate a single-byte character expression to a double-byte character expression, or translate a double-byte character expression to a single-byte character expression.
The maximum number of pairs of to and from arguments that KTRANSLATE accepts depends on the operating environment you use to run SAS. There is no functional difference between using several pairs of short arguments, or fewer pairs of longer arguments.