Fluorite | Level 6

## Displaying exact value in BASE SAS

Hi,

I notice when i use SAS base, it will round the figure if it is more than 18 digit.

Is there any setting in server/client machine if we want to show exact value?

Following are the sample code i use

data test;

format b best32.;

format d best32.;

format f best32.;

x = '0010000000130000123';

y = '001000000013000012';

z = '00100000001300001';

len1 = length(x);

len2 = length(y);

len3 = length(z);

b = input(x, best32.);

d = input(y, best32.);

f = input(z, best32.);

run;

5 REPLIES 5
Quartz | Level 8

## Re: Displaying exact value in BASE SAS

There are limitations on the storage of large numbers. See the discussion on numeric precision at SAS(R) 9.2 Language Reference: Concepts, Second Edition.

If you aren't using the number for mathematical operations, why not leave it as text?

If you are doing mathematical operations, then SAS floating point representation might be good enough?

If you insist on storing the entire number, try the w.d informat. And don't use the BEST format. The downside is increased disk space. You could use the COMPRESSION=BINARY option to offset this.

data test;

format b c d 32.;

x = '0010000000130000123';

y = '001000000013000012';

z = '00100000001300001';

len1 = length(x);

len2 = length(y);

len3 = length(z);

b = input(x, 32.);

c = input(y, 32.);

d = input(z, 32.);

run;

Fluorite | Level 6

## Re: Displaying exact value in BASE SAS

Hi,

After added command option COMPRESS=BINARY; in our script and the outcome still the same, still round the value to 0010000000130000124.

I'm using SAS 9.1.3. Is there any difference between SAS 9.2 and SAS 9.1.3?

Barite | Level 11

## Re: Displaying exact value in BASE SAS

mikesatriavo,

Did you read teh reference fugue had given? SAS(R) 9.4 Language Reference: Concepts (Numeric Precision in SAS Software). The title here is wrong it is not SAS related as it applies to all kind of floating processing (flops). It is IEE standard.

This is something as fundamental to calculations for a very very long time. Floatings are by definition not precise.

Compressing is just a method for saving dasd space doesn't have any effect to numeric precision (length max=8 has).

The remark on handling as character is also sensible.

- The average on female=1 male=2 makes no sense as it is a classification.

- IBAN numbers are even no numbers.

The way of limiting to numbers at sme areas is going back to the old hollerith age having visible 10 columns.

Working on a DBMS with those many more datatypes, there is a new language added in SAS (9.3 last uypdates, 9.4) "PROC DS2" http://support.sas.com/documentation/cdl/en/proc/64787/HTML/default/viewer.htm#n08hc15x330v75n1vjw9r...

---->-- ja karman --<-----
Pyrite | Level 9

## Re: Displaying exact value in BASE SAS

Hi! What kind of data or problem do you have, since you consider that the data values have 18 correct digits ?
In real life the relative error in the numbers is often quite big. I would guess that it is very unusual to have more than 7 or 8 correct digits in measured values. Even in cases where you have many correct digits, they are often not of interest.
Of course Bank account numbers etc. are longer - but they are not measured values. They should be stored as characters.
Jaap and others above have given very good and detailed technical answers.

/ Br Anders Sköllermo (Andrew Skollermo in English)

Anders Sköllermo (Skollermo in English)
PROC Star

## Re: Displaying exact value in BASE SAS

This is a known SAS limitation, with a recent discussion here: