SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Tranwrd for multiple values

Reply
Regular Contributor
Posts: 181

Tranwrd for multiple values

I want to group some values into one value. For eg : I have data for college names and some names are written in short form and some in full forms. The task is to group them into one name. I am using TRANWRD function to do it. Is it possible to group multiple values into one using TRANWRD function? I know the two datasets can be merged for it.

Super User
Posts: 10,500

Re: Tranwrd for multiple values

Examples of what you have and what you want. Depending on the number of records you might be able to create a format but tranwrd isn't going to get you there without a many lines of code though it can regularize some things common contractions to a single standard.

Super User
Posts: 9,681

Re: Tranwrd for multiple values

You need multiple tranwrd() for that purpose . But you can combine them all into one function :

if prxmatch('/ArthurT|ArthurC|ArthurK/',name) then name='Arthur' ;

Xia Keshan

Regular Contributor
Posts: 181

Re: Tranwrd for multiple values

Thanks a ton Ksharp. It works like a charm :-)

Super User
Posts: 5,256

Re: Tranwrd for multiple values

I think you are on the wrong track. Spelling variations will most likely expand over time, and you don't to update your program each time.

Use a look-up table with incorrect - correct (normalized) spelling pairs. Then use the look-up technique you feel most comfortable with (user defined formats, SQL join etc).

Data never sleeps
N/A
Posts: 1

Re: Tranwrd for multiple values

I think Ksharp may be right, using regular expression is a good way~~~

Ask a Question
Discussion stats
  • 5 replies
  • 637 views
  • 2 likes
  • 5 in conversation