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 (September 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 16 Sep 2008 17:17:58 -0400
Reply-To:     Paul Walker <walker.627@OSU.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Walker <walker.627@OSU.EDU>
Subject:      Best way to dedupe a character string

What is the best way to dedupe a character string stored in a datastep variable? Here is how I would like to call it, using the imaginary function %Dedupe:

data Work.NeedToDedupe; length Letters $ 100; Letters = 'A B C C C D E E'; Output; Letters = 'A A A A A B B B'; Output; run;

data Work.Deduped; set Work.NeedToDedupe; LettersNoDup = %Dedupe(Letters); put Letters= LettersNoDup=; run;

Letters=A B C C C D E E LettersNoDup= A B C D E Letters=A A A A A B B B LettersNoDup= A B

Does anyone have such a macro or is there a SAS function that does this?

TIA, - Paul


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