Date: Tue, 20 Apr 2004 14:31:04 -0400
Reply-To: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Subject: Re: search for a string term
On Tue, 20 Apr 2004 10:13:37 -0700, Max503 <max8ca@YAHOO.COM> wrote:
>I used index() to search for "F BUMPER". The returned results
>contain strings like "OF BUMPER". How do I restrict the serach
>to the exact string term I defined? Thanks.
>
>Max
Max,
The INDEXW function might work for you. Even though it is typically
associated with looking for a WORD, the documentation is not very clear.
That said, I am not sure what is the end goal. If you are trying to
identify a set pattern that has a white space before and after, this could
work:
data _null_ ;
input @1 mystring $char50. ;
indw=indexw(mystring,"F BUMPER");
put indw= ;
cards ;
GET F BUMPER
GET OF BUMPER
WHAT IF BUMPER
WHAT A F BUMPER
GET F BUMPERS
run ;
Kind Regards,
Venky Chakravarthy
|