Date: Thu, 17 Feb 2011 09:05:17 -0500
Reply-To: Lorne Klassen <lk1@ROGERS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lorne Klassen <lk1@ROGERS.COM>
Subject: Re: Counting digits
Barry, I should've mentioned that our values will never go beyond large
dollar amounts. I can't see any way we would have more than 12 digits to
the left of the decimal. I just used the format 32. for good measure.
On Thu, 17 Feb 2011 03:58:34 -0800, Schwarz, Barry A
<barry.a.schwarz@BOEING.COM> wrote:
>What value would like to obtain for the SAS constant 1.35e147?
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lorne
Klassen
>Sent: Wednesday, February 16, 2011 3:47 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Counting digits
>
>Simple question: I want to get the number of digits to the left of the
>decimal place from a value in a numeric variable (excluding negative sign
>if there is one).
>
>I can live with the following which works but I'm wondering if it can be
>even simpler than this? I thought there might be a numeric function to do
>it directly but couldn't find one.
>
>y = 76877.234;
>result = countc(put(int(y),32.),,"d");
> or
>result = length(compress(put(int(y),32.)," -"));
|