Date: Fri, 20 Sep 1996 18:11:02 +0100
Reply-To: John Whittington <johnw@MAG-NET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: John Whittington <johnw@MAG-NET.CO.UK>
Subject: Re: SASTip: Dw.s format for # of Sig digits
On Thu, 19 Sep 1996, Don MacQueen <macq@JAMIE.LLNL.GOV>
>The SAS Dw.s format fails because it displays _at least_ s digits. That is,
>it will show as many more digits than s as it has room for. I don't know what
>they thought this format was good for, but it isn't significant digits.
Don, that is indeed the point that I made in my recent posting. Not only
don't I understand what they thought this format was good for, but I don't
even understand precisely how one could 'describe' it's seemingly rather
strange behaviour!
As I pointed out some time ago, the 'number of significant digits' problem
can, fortunately, be solved using the Ew. format (and probably in other
ways. too!). For example, E10. can be used to round to four significant
digits (or E11. to 5 sig digits etc.). In the following X is the supplied
variable and Z is the version rounded to 4 sig digits:
data one;
set test ;
z = input ( put (x, E10.), E10.) ;
run ;
proc print data=one; format x z best12.; run ;
.... which produces output:
OBS X Z
1 123456 123500
2 12345.6 12350
3 1234.56 1235
4 123.456 123.5
5 12.3456 12.35
6 1.23456 1.235
7 0.123456 0.1235
8 0.0123456 0.01235
9 0.00123456 0.001235
10 0.000123456 0.0001235
11 0.0000123456 0.00001235
Regards,
John
-----------------------------------------------------------
Dr John Whittington, Voice: +44 1296 730225
Mediscience Services Fax: +44 1296 738893
Twyford Manor, Twyford, E-mail: johnw@mag-net.co.uk
Buckingham MK18 4EL, UK CompuServe: 100517,3677
-----------------------------------------------------------