Help using Base SAS procedures

Search and replace contents inside a variable.

Reply
Not applicable
Posts: 1

Search and replace contents inside a variable.

Hi,

How do I search and replace contents inside a variable?

Example:

from this var1 = 'THIS IS SO NEAT';

to this var1 = 'THIS_IS_SO_NEAT';

Thankx,
S
Super Contributor
Super Contributor
Posts: 3,176

Re: Search and replace contents inside a variable.

In a DATA step, look at using either the TRANSLATE or sometimes consider using TRANWRD, depending on the application. Refer to the SAS Language documentation and also the SAS support website for supplemental technical reference material.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search argument, this topic/post:

sas variable search replace character site:sas.com
Ask a Question
Discussion stats
  • 1 reply
  • 111 views
  • 0 likes
  • 2 in conversation