1.

What is the importance of the Tranwrd function in SAS.

Answer»

TRANRWD, when APPLIED to a character string, replaces or eliminates all occurrences of a substring. By USING TRANWRD, you can scan for words (or patterns of characters) and replace them with a second word (or pattern of characters).  

Syntax:   

TRANWRD(source, target, replacement)  

Here,  

  • The source is a character constant, VARIABLE, or expression you wish to translate.
  • The target is an expression, constant, or variable searched in the source.
  • Replacement specifies an expression, constant, or variable that will replace target.

Example:    
name : MRS. JOHNY Lever  
name=tranwrd(name, "Mrs.", "Ms.");   
Result : Ms. Johny Lever 



Discussion

No Comment Found