|
--- 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
|