Date: Tue, 10 Jun 2008 05:31:17 -0700
Reply-To: Lou <lpogoda@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogoda@HOTMAIL.COM>
Organization: http://groups.google.com
Subject: Re: length of numeric expression
Content-Type: text/plain; charset=ISO-8859-1
On Jun 10, 6:45 am, shashi <shashi2...@gmail.com> wrote:
> Is there any function or way either in Base SAS or in Proc Sql to find
> the length of a numeric string including leading zeroes?
> For example,
>
> Numeric expression length
> 0401117 7
>
> could anybody please suggest on this?
>
> Thanks,
> Shashi
Your question is a little confused, so it's hard to give a
straightforward answer. SAS values are either character or numeric,
and the word "string" is sometimes used to mean character. The phrase
"numeric string" doesn't mean anything.
If the value you're talking about is numeric, there are no leading
zeroes in the value, though any number of leading zeroes may be
displayed depending on the format assigned for printing/display
purposes. If the value you're talking about is character, you find
the length of the value the same way you would for any other character
value (the fact that all the characters in the value are numerals is
irrelevant), and you have other replies showing you how to do that.
|