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 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 1 Aug 2003 20:56:12 +0000
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:      Re: Compress multiple spaces _outside_ quoted values ?
Comments: To: radevenz@IX.NETCOM.COM
Content-Type: text/plain; format=flowed


Not too elegant, but you could try

data _null_ ; retain s " begin 'one quote' no quote ' another quote ' end string" ; do x = index (s, "'") to length (s) ; if substr (s, x) =: "'" then do ; p = not p; continue ; end ; if not p then continue ; if substr (s, x) =: '' then substr (s, x, 1) = 'ff'x ; end ; s = translate ( compbl (s), '', 'ff'x) ; put s $100. ; run ;

which prints

begin 'one quote' no quote ' another quote ' end string

I bet you have already come up with that much yourself :-).

Kind regards, =============== Paul M. Dorfman Jacksonville, FL ===============

>From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM> > >I have a string containing multiple spaces, that typically would be >compressed out using COMPBL. However, I don't want to remove multiple >spaces >if they are within quotes. > >Any ideas how to achieve this ? > >-- >Richard A. DeVenezia

_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.

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