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 (July 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 23 Jul 2003 05:21:48 +0000
Reply-To:     sashole@bellsouth.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:      Re: Conditional character concatenation
Comments: To: MurffMJ@LDSCHURCH.ORG
Content-Type: text/plain; format=flowed

Mike,

I frankly think that SAS-centric-wise, Ravi's offer is the cleanest... but agree with Jack that you may really want a character-to-character mapping without a double type conversion, in which case I wonder if a solution simpler than that which follows can be obtained:

newstr = "000000" ; substr (newstr, 1, length(oldstr)) = oldstr ;

It assumes that the input string OLDSTR has been LEFTed, else replace all occurrences OLDSTR by LEFT(OLDSTR).

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

>From: Michael Murff <MurffMJ@LDSCHURCH.ORG> > >Dear SAS-L, > >I want to conditionally concatenate zeros onto the end of a string. The >condition is how many characters exist to the _right_ of the decimal. I >need all values to have zeros out to three decimal places IF no other >integer occupies that space; else the variable should remain unchanged. For >instance, > >3.5 --> 3.500 >3.51 --> 3.510 >3.511--> 3.511 >12.1-->12.100 >12.11 --> 12.110 >12.111-->12.111 > >I've used the index function to append characters on the front of string, >but his seems like the opposite problem. Hopefully this problem is not so >trivial that it fails to illicit responses. > >Thanks, > >Mike Murff >SLC, Utah

_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


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