LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: inason <iharun17@googlemail.com>
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 >


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