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 (August 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 3 Aug 2007 09:13:01 -0400
Reply-To:     "A.K. Lee" <aktivelee@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "A.K. Lee" <aktivelee@YAHOO.COM>
Subject:      Re: Round function
Comments: To: Jason Dale <Dale.Jason@BLS.GOV>

The diff. between formatting the values and round function is that rounding is permanent(in assignment statement) while formatting is just for display.

For Ex: 23.3496 when formatted with 8.2 will remain 23.3496 but diplayed as 23.35, while if you the round it and assign it to another variable (var2=ROUND(var1,.01) then the value of the new variable is 23.35 and in this case format statement is redundant (since we want 2 decimals places)

But of course trailing zeroes (for ex: 23.30) is a question of formatting only and will require the statement 'format var2 8.2;' -A

On Wed, 1 Aug 2007 14:45:47 -0400, Dale, Jason - BLS <Dale.Jason@BLS.GOV> wrote:

>Thanks for everyones suggestions. Formatting my values corrected my >problem in SAS.. Although, my values are ultimately ending up in Excel, >which again drops the zeros.. So this is something I will need to >correct in Excel.. Thanks again! > >jason > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >Melvin Klassen >Sent: Wednesday, August 01, 2007 2:00 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: Round function > >On Wednesday, August 01, 2007 8:20 AM"Dale, Jason - BLS" ><Dale.SpamAlot.Jason@BLS.GOV> wrote: > >> I am using the round function to truncate to 2 decimal places. >> When the second decimal place is a zero, SAS drops it. >> For example, instead of showing 1.20, SAS will output 1.2. >> I would like the zero to be shown. Is there a quick fix for this? > >Note that the SAS output-formats do their own "rounding", so you may not >need to explicitly do what SAS implicitly does for you: > >DATA SQUARE; > DO X = 1194 TO 1206; > Y = X / 1000; > PUT Y 6.2 X 7.0 ; > END; >TITLE 'Display "1.20" most of the time'; RUN; > >if your only need is to display the "rounded" value. > > ... Melvin ("work smarter, not harder")


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