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 (October 1999, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 25 Oct 1999 00:17:31 -0400
Reply-To:     S David Riba <dave@JADETEK.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         S David Riba <dave@JADETEK.COM>
Subject:      Re: Searching for any one of a series of words
Comments: To: Mike Sacca <nj1pro.msacca@SDPS.ORG>
Content-Type: text/plain; charset="iso-8859-1"

> I want to use something like this: > foundchr = indexc(address1,'street','road','lane','court');

The function you are looking for is INDEXW, which looks for entire words, instead of individual characters. However, like INDEX, it takes as an argument a single character string. I can suggest two possible solutions:

1. Use INDEXW inside of an array loop like this:

ARRAY target (4) $ _temporary_ ('street' 'road' 'lane' 'court'); address = 'Mayfair Road' ; do i = 1 to dim(target) ; if (indexw(upcase(address),upcase(target(i)))) then leave ; end ;

2. Use a WHERE statement with the CONTAINS operator. However, again you are limited to a single comparison. For example:

WHERE upcase(address) CONTAINS 'STREET' | upcase(address) CONTAINS 'ROAD' ;

HTH

Dave

---------------------------------------------------------------------------- S. David Riba INTERNET: dave@JADETEK.COM JADE Tech, Inc. http://www.jadetek.com P O Box 4517 Clearwater, FL 33758 SAS Certified Professional - V6 VOICE: (727) 726-6099 A SAS Institute Quality Partner

SAS. It's not just an attitude


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