Date: Thu, 28 Aug 2003 12:55:27 +0100
Reply-To: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Organization: Universe Monitors
Subject: Re: formating decimal values
This has cropped up on this newsgroup before and so I decided to write a
macro solution. You can see it here:
http://www.datasavantconsulting.com/roland/aligndp.sas
It can be linked to from the following page and you will see the macro comes
with a test pack:
http://www.datasavantconsulting.com/roland/sasautos.html
If anybody spots any problems while using the macro then let me know.
Roland
"Kristie Kooken" <kkooken@PDD.NET> wrote in message
news:209DB5C96263544EBB6E1B1B8AEF01271F6F38@pddex1.pdd.net...
> 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
|