BESTDw.p Format

Prints numeric values, lining up decimal places for values of similar magnitude, and prints integers without decimals.

Category: Numeric
Alignment: Right
Interaction: When the DECIMALCONV= system option is set to STDIEEE, the output that is written using this format might differ slightly from previous releases. For more information, see DECIMALCONV= System Option in SAS System Options: Reference.

Syntax

BESTDw.p

Syntax Description

w

specifies the width of the output field.

Default 12
Range 1–32

p

specifies the precision. This argument is optional.

Default 3
Range 0 to w–1
Requirement must be less than w
Tip If p is omitted or is specified as 0, then p is set to 3.

Details

The BESTDw.p format writes numbers so that the decimal point aligns in groups of values with similar magnitude. Integers are printed without a decimal point. Larger values of p print the data values with more precision and potentially more shifts in the decimal point alignment. Smaller values of p print the data values with less precision and a greater chance of decimal point alignment.
The format chooses the number of decimal places to print for ranges of values, even when the underlying values can be represented with fewer decimal places.

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 are printed 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 it does not necessarily show the same precision for all numbers.

Example

put x bestd14.;
Data Line
Result
----+----1----+
12345
         12345
123.45
   123.4500000
1.2345
     1.2345000
.12345
     0.1234500
1.23456789
     1.2345679

See Also