BESTw. Format

SAS chooses the best notation.

Category: Numeric
Alignment: Right

Syntax

BESTw.

Arguments

w

specifies the width of the output field.

Default 12
Range 1–32
Tip If you print numbers between 0 and .01 exclusively, use a field width of at least 7 to avoid excessive rounding. If you print numbers between 0 and –.01 exclusively, use a field width of at least 8.

Details

The BESTw. format is the default format for writing numeric values. When there is no format specification, SAS chooses the format that provides the most information about the value according to the available field width. BESTw. rounds the value, and if SAS can display at least one significant digit in the decimal portion, within the width specified, BESTw. produces the result in decimal. Otherwise, it produces the result in scientific notation. SAS always stores the complete value regardless of the format that you use to represent it.

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.

Example

Statements
Results
----+----1----+----2
select put(1257000,best6.);
1.26E6
select put(1257000,best3.);
1E6
Last updated: February 23, 2017