Formats |
Category: | Numeric |
Alignment: | right |
See: | BESTw. Format under z/OS |
Syntax | |
Syntax Description | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
BESTw. |
specifies the width of the output field.
Details |
When a format is not specified for writing a numeric value, SAS uses the BESTw. format as the default format. The BESTw. format writes numbers as follows:
Values are written with the maximum precision, as determined by the width.
Integers are written without decimals.
Numbers with decimals are written with as many digits to the left and right of the decimal point as needed or as allowed by the width.
Values that can be written within the given width are written without trailing zeros.
Values that cannot be written within the given width are written with the maximum allowable number of decimal places as determined by the width.
Extreme values might be written in scientific notation.
SAS stores the complete value regardless of the format that is used.
Comparisons |
The BESTw. format writes as many significant digits as possible in the output field, but if the numbers vary in magnitude, the decimal points do not line up. Integers print without a decimal.
The Dw.p format writes numbers with the desired precision and more alignment than the BESTw format.
The BESTDw.p format is a combination of the BESTw. format and the Dw.p format in that it formats all numeric data, and it does a better job of aligning decimals than the BESTw. format.
The w.d format aligns decimal points, if possible, but does not necessarily show the same precision for all numbers.
Examples |
The following statements produce these results.
SAS Statements | Results |
---|---|
|
----+----1----+----2 |
x=1257000; put x best6.; |
1.26E6 |
x=1257000; put x best3.; |
1E6 |
See Also |
Format:
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.