LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1999, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 23 Dec 1999 15:24:50 +0100
Reply-To:     Mike <m.hagendoorn@EARTHLINK.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike <m.hagendoorn@EARTHLINK.NET>
Organization: EarthLink Network, Inc.
Subject:      Re: Replacing/Deleting an occurrence of a string in a field

Hi Jim,

The function you're looking for is TRANWRD. Here's how to do either (1) or (2):

1) Get rid of all instances of " INC " and " CORP " in variable a:

a=TRANWRD(a, " INC", ""); a=TRANWRD(a, " CORP", "");

Note: The third argument is two double quotes with no blank in between.

2) Replace all instances " INC " with " CORP " in variable a:

a=TRANWRD(a, " INC", " CORP");

Hope this helps y'out, Happy Holidays,

Mike H

LINCK, JIM <LINCK@SIMON.ROCHESTER.EDU> wrote in message news:F02DBDF74319D311B65E00A0C9499F372404EB@mail2... > I have an approximately 32 character field in a couple SAS data sets that I > am trying to match up. One of the problems caused in the matching is that " > INC " and " CORP " (with spaces so they are not part of the name) are > sometimes mixed and matched. While I can easily compress out instances of > single characters, I do not know how to compress out and/or replace > instances of a whole string with another whole string. That is, I'd like to > do a couple things: > 1. Get rid of all instances of " INC " and " CORP " in the variable > 2. Replace all instances " INC " with " CORP " > Any suggestions? > Thanks. > Jim


Back to: Top of message | Previous page | Main SAS-L page