Date: Tue, 31 Mar 2009 11:36:21 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Is there a way to remove trailing zeros from a numeric
variable?
In-Reply-To: <543216.62201.qm@web50902.mail.re2.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1
It rather depends on what you're planning on doing with the number. In
what, precisely, do you want to see the number formatted that way? In a
proc print/freq/means/report/etc.? In an export to another data type
(excel, access, spss, sql, etc.)?
-Joe
On Tue, Mar 31, 2009 at 11:27 AM, Brian Wallace
<brian_c_wallace@yahoo.com>wrote:
> I keep running up against the defined format. I've tried converting the
> numeric variable back to a character using the BEST format then BACK to a
> numeric but I keep losing precision.
>
> An example. I've converted these character variables to numeric variables:
>
> character variables --> converted to --> numeric variables
>
> 49.9568 sq. cm 49.9568000
> 50.3701 sq. cm 50.3701000
> 6.43636 sq. cm 6.4363600
> 4.48661 sq. cm 4.4866100
> 0.0297726 sq. cm 0.0297726
>
> Now, I need to remove those trailing zeros, yet keep the variable a numeric
> variable and not loose any precision. I need them to look like:
>
> 49.9568
> 50.3701
> 6.43636
> 4.48661
> 0.0297726
>
> but still remain numbers.
>
> Any suggestions would be greatly appreciated.
>
> Thank you,
>
> Brian Wallace
>
|