Date: Tue, 23 Jun 2009 11:03:17 -0400
Reply-To: Akshaya <akshaya.nathilvar@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Akshaya <akshaya.nathilvar@GMAIL.COM>
Subject: Re: delete repeat
In-Reply-To: <79c4f615-eece-4247-bb2b-dbd4e7336640@e39g2000yqh.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Following code may not work in all scenarios, play with (_string) variable
to concatenate more words to get rid of duplicates from your real data.
Data have;
infile cards truncover;
input reason $200.;
cards;
subject left visit to make a phone call subject left visit to make a phone
call
subject terminated violation of inclusion criteria subject terminated
violation of inclusion criteria
;
Data want;
set have;
_string=catx(' ',scan(reason,1),scan(reason,2));
do _i=1 to countw(reason);
call scan(reason,_i,position,length);
if indexw(substr(reason,position),_string) then
final=substr(reason,position);
end;
drop _: position length;
Run;
AkshayA!
On Tue, Jun 23, 2009 at 9:32 AM, inason <iharun17@googlemail.com> wrote:
> Hi Guys,
>
> I'm wondering if there is a sas function that deletes duplications.
> So if a variable had a repeat of text, is there a function of getting
> rid of the repeat.
> I.e
> X= subject left visit to make a phone callsubject left visit to make a
> phone call.
>
> in teh dataset I got end of sentence and repeat are together as above
> 'callsubject'.
>
>
> Thanks
>
|