Date: Tue, 3 Sep 2002 11:49:31 -0400
Reply-To: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
Subject: Re: tranwrd
Content-Type: text/plain; charset=iso-8859-1
Doug,
But how is it supposed to have worked in the first place if you have used a
wrong function? If you want to find whether a string contains a space-bound
word, use the INDEXW() as in
if indexw(name, 'joe') ;
The way use have used TRANWRD(), it would merely transform all 'xyz' strings
into 'joe', and that regardless of the space boundaries between words. If I
were you, I would RTFM-check whenever I should be intrigued by the
colleague.
Kind regards,
====================
Paul M. Dorfman
Jacksonville, FL
====================
> From: Doug [mailto:queanbeyan@HOTMAIL.COM]
>
> I wish to ouput to a new dataset based on if a variable contains a
> particular string. However I cannot seem to get SAS to output based
> on the second line of data 'q joe' (if I take the q away then it works
> fine). Is there a trick to this or am I using the wrong routine. I
> can do this with sql and 'where name contains ...' but I am intrigued
> by a colleague who mentioned using tranwrd for this.
>
> data joe;
> input name $8.;
> datalines;
> robin
> q joe
> ;
> run;
> data jill;
> set joe;
> if tranwrd(name,'joe','xyz') eq 'xyz';
> run;
>
> Thanks
>
> Doug
>
>
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.
|