[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: Finding repeating characters
From: Huck <huck () FINN ! NOSPAM ! MOC>
Date: 2003-07-31 23:55:31
[Download RAW message or body]
On Thu, 31 Jul 2003 16:20:54 -0400, Huck <huck@finn.nospam.moc> still
the fool who follow-up his own posts wrote:
>On 31 Jul 03 18:21:52 GMT, dan_schuster@MEDCOHEALTH.COM (Dan Schuster)
>wrote:
>
>>Is there a function or whatever to find characters that are repeated 5 or
[ ... ]
>data found(keep=found string at);
> set a;
> at=1;
> _len=1;
> if 1=0 then found=string;
> do _i=2 to length(string);
> if substr(string,_i-1,1) ne substr(string,_i,1) then do;
> if _len ge 5 then link found;
> _len=1;
> at=_i;
> end;
> else do;
> _len+1;
> end;
> end;
>
>if _len ge 5 then link found;
>
>return;
>
>found:;
>found=substr(string,at,_len);
>output;
>return;
>
this finds and identifies each one, not just the first.
47 data _null_; set found;
48 put at= found= string=;
at=9 found=aaaaa string=This is aaaaa character string
at=1 found=sssss string=ssssstart of the string
at=35 found=ggggg string=here's one on the end of the stringgggg
at=9 found=mmmmmmmmmm string=here is mmmmmmmmmmoooooooore than
oooooooooone
at=19 found=oooooooo string=here is mmmmmmmmmmoooooooore than
oooooooooone
at=35 found=oooooooooo string=here is mmmmmmmmmmoooooooore than
oooooooooone
at=15 found=oooooooooooooo string=he said 5 or moooooooooooooore
at=33 found=AAAAA string=more consecutive times such as 'AAAAA'
through 'ZZZZZ' anywhere in a
at=49 found=ZZZZZ string=more consecutive times such as 'AAAAA'
through 'ZZZZZ' anywhere in a
at=36 found=aaaaa string=character string. Example 'This is aaaaa
character string' that I want to
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic