As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

BEST format

From sasCommunity
Jump to: navigation, search

When the BESTw. format is used, SAS (according to the documentation), "chooses the best notation".

Is the result always best?

Apparently not. When w>16, it seems that SAS truncates rather than rounding. For example, consider the mathematical constant e, the base of natural logarithms. Its value (to 20 decimal places) is


The SAS statement

%put e = %sysfunc(constant(e),best16.);

renders it to 14 decimal places and rounds the last of these, yielding

e = 2.71828182845905

If the width is increased to 17, the result is still limited to 14 decimal places (reflecting the precision limits of the hardware), but the value is truncated, yielding

e =  2.71828182845904

This is not a best result, in the sense that a concatenation of one blank followed by the rounded result generated by BEST16. would be better.

Note: The examples above were run using SAS 9.2 on a Windows system.

Is there a BESTw. informat?

There is really no need for such an informat, since the basic W.d informat handles all notations. The rationale for the BESTw. format does not apply symmetrically to character-to-numeric conversions. However, SAS does support BESTw. as an alias for the W.d informat.