|Date: ||Wed, 6 Jul 2005 07:54:52 +0000|
|Reply-To: ||Guido T <cymraeg_erict@HOTMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Guido T <cymraeg_erict@HOTMAIL.COM>|
|Subject: ||Re: delete duplicate string within a single variable|
|Content-Type: ||text/plain; format=flowed|
I was a bit too quick with my initial "solution". The middle compress isn't
needed, compressing out extra spaces isn't a problem. Also TRANSLATE only
needs a single space to translate to. How many years have I been using
TRANSLATE function? Sigh...
What it does is compress out of the _DIGITS string (containing the valid
character, in the correct order) the characters from *A* that aren't in the
295 data test(drop=_digits);
296 set xx;
297 retain _digits '0123456789';
298 x = compress(_digits,translate(_digits,' ',a));
299 put a= x=;
NOTE: There were 5 observations read from the data set WORK.XX.
NOTE: The data set WORK.TEST has 5 observations and 3 variables.
NOTE: DATA statement used:
real time 0.01 seconds
cpu time 0.01 seconds