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 (January 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 21 Jan 2005 14:08:01 -0800
Reply-To:   Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Comments:   DomainKeys? See http://antispam.yahoo.com/domainkeys
From:   Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:   Re: Looking for something equivalent to RTRIM
Comments:   To: Ya Huang <ya.huang@AMYLIN.COM>
In-Reply-To:   <200501212124.j0LLOgv2031164@listserv.cc.uga.edu>
Content-Type:   text/plain; charset=us-ascii

--- Ya Huang <ya.huang@AMYLIN.COM> wrote:

> On Fri, 21 Jan 2005 12:59:06 -0800, omugeye <bhuta_zegha@YAHOO.COM> > wrote: > > >substr(right(chaV), 10, -1) worked for me with no error. Am running > >version 9.1. > > > >Well, the beauty of SAS is being able to do one thing several > different > >ways. As has been demonstrated here. One of these solutions must > have > >worked for Chadd Webb. Clearly some are more efficient than others. > > Can you explain what exactly '-1' do here? Does it mean to start from > 10th byte and backward extract one byte? Would it result in a single > character? >

Ya,

In version 9.x, a negative length expression has the following consequence (taken straight from the online docs http://support.sas.com/onlinedoc/912/docMainpage.jsp)

If length is zero, a negative value, or larger than the length of the expression that remains in string after position, SAS extracts the remainder of the expression. SAS also sets _ERROR_ to 1 and prints a note to the log indicating that the length argument is invalid.

So, a negative length value is an invalid expression. The substr function sets the _ERROR_ indicator, but otherwise operates as though no length function was specified.

Dale

===== --------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@NO_SPAMfhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail


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