BookmarkSubscribeRSS Feed
mikesatriaevo
Fluorite | Level 6

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?

Please advice. Thank you.

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;


Result1.jpg
5 REPLIES 5
Fugue
Quartz | Level 8

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;

mikesatriaevo
Fluorite | Level 6

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?



jakarman
Barite | Level 11

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 --<-----
AndersS
Pyrite | Level 9

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)
Astounding
PROC Star

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

https://communities.sas.com/thread/48679

Good luck.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2399 views
  • 0 likes
  • 5 in conversation