LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Aug 2007 18:22:51 -0400
Reply-To:     sas_andy@BOOSECAT.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Andy Andrews <sas_andy@BOOSECAT.COM>
Subject:      Removing words from a string
Content-Type: text/plain; charset=UTF-8

Hi all...you helped out so much earlier I thought I'd throw another bone in! I have 2 macro variables - good and bad. I need to remove all instances of the words in bad from good.

For example: %let good=blue white red yellow orange purple black; %let bad=yellow purple;

I need to remove "yellow" and "purple" from the macro variable good. I'm currently breaking apart the variables word by word, then merging them back in where it's in good and not in bad. This works great, however the code is a little long and ugly. It doesn't matter how the data ends back up. It can be a single-variable dataset (currently what I have), another macro variable, etc.

Thanks! I hope this makes sense to someone!


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