Date: Fri, 27 Jun 2003 15:28:56 -0400
Reply-To: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject: Re: word position
Content-Type: text/plain; charset="iso-8859-1"
Ganesh:
If it's really a WORD you're looking for, e.g. a string of characters
delimited by blanks or the extremities of the searched string, use the
indexw function:
data _null_;
long = 'The quick brown fox jumped over the lazy dog';
word = ' over ';
start_pos = indexw(long,word);
if start_pos then
end_pos = start_pos + length(compress(word)) - 1;
put start_pos= / end_pos=;
run;
-----Original Message-----
From: Ganesh Tamarana [mailto:tamaranaganesh@YAHOO.COM]
Sent: June 27, 2003 3:11 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: word position
Hello Everyone,
can anyone know , how to find a word starting
and ending
positions in the string. Can any help me in this regards,
Thanks in advance,
Ganesh
|