Fluorite | Level 6

## FORMAT

I tried to understand BEST12 formatting but the manuals do not explained it to my understanding. can somebody explain it with example for me?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: FORMAT

SAS will reserve space for 12 characters to be displayed, and then it will fit the number into it as good as possible.

If up to 12 digits left of the decimal point are present in your number, the number will be displayed in the usual way, digits to the right of the decimal point will be discarded once they exceed the 12 spaces.

As long as no more than 12 digits (including the decimal point) are present, everything will be displayed, with the decimal point shifting to wherever it ends up.

Numbers with more than 12 digits to the left will be displayed in scientific notation.

Run this code to illustrate this:

``````data test;
input number;
format number best12.;
datalines;
1
1.25
1.23456
123456789.12345
123456789012.12345
1234567890123
;
run;

proc print data=test noobs;
run;``````

Result:

```      number

1
1.25
1.23456
123456789.12
123456789012
1.2345679E12
```

Super User

## Re: FORMAT

SAS will reserve space for 12 characters to be displayed, and then it will fit the number into it as good as possible.

If up to 12 digits left of the decimal point are present in your number, the number will be displayed in the usual way, digits to the right of the decimal point will be discarded once they exceed the 12 spaces.

As long as no more than 12 digits (including the decimal point) are present, everything will be displayed, with the decimal point shifting to wherever it ends up.

Numbers with more than 12 digits to the left will be displayed in scientific notation.

Run this code to illustrate this:

``````data test;
input number;
format number best12.;
datalines;
1
1.25
1.23456
123456789.12345
123456789012.12345
1234567890123
;
run;

proc print data=test noobs;
run;``````

Result:

```      number

1
1.25
1.23456
123456789.12
123456789012
1.2345679E12
```

Discussion stats