Functions and CALL Routines |
Category: | Character |
Restriction: | I18N Level 0 |
Tip: | DBCS equivalent function is KTRANSLATE in SAS National Language Support (NLS): Reference Guide. |
See: | TRANSLATE Function under Windows UNIX OpenVMS z/OS |
Syntax | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
TRANSLATE(source,to-1,from-1<,...to-n,from-n>) |
specifies a character constant, variable, or expression that contains the original character string.
specifies the characters that you want TRANSLATE to use as substitutes.
specifies the characters that you want TRANSLATE to replace.
Operating Environment Information: 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 |
In a DATA step, if the TRANSLATE function returns a value to a variable that has not previously been assigned a length, then that variable is given the length of the first argument.
The maximum number of pairs of to and from arguments that TRANSLATE 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.
Comparisons |
The TRANWRD function differs from TRANSLATE in that it scans for words (or patterns of characters) and replaces those words with a second word (or pattern of characters).
Examples |
SAS Statements | Results |
---|---|
x=translate('XYZW','AB','VW'); put x; |
XYZB |
See Also |
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.