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 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 27 Aug 2003 14:22:47 -0700
Reply-To:     Kristie Kooken <kkooken@PDD.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kristie Kooken <kkooken@PDD.NET>
Subject:      formating decimal values
Content-Type: text/plain; charset="iso-8859-1"

Hi SAS-L,

I am having a problem displaying decimal values using a data _null_, here is my problem....

I have a variable named bsa that was input using the best format. I want to display this variable in a report using data _null_, unfortunately, I am to only display however many decimal places there are, and not pad the cases where there are no decimals with zeros. For example, I have one value that is 2.333 and some others that are 1.5 and some that are 5. I must display how they appear in the dataset and NOT 2.333, 1.500, 5.000.

Also, I need these values to lineup on the decimal place in the report.

I made a counter variable that counts the number of place that exist after the decimal:

count= '8'||'.'||compress((length(trim(left((scan(bsa, 2, '.'))))))-((scan(bsa, 2, '.'))=''));

I was using the 8. beginning part in order to generate a format... I was making this variable a character variable being that character variables tend to line up better in data _null_ (well, that been my experience..)

Then I was going to try to put this in a do loop... it works okay but it seems really long and complicated.... I was hoping someone had another solution. I haven't really dealt with such a problem before and couldn't find a similar subject in the SAS-L archives.

Thanks, Kristie


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