turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- ODS and Base Reporting
- /
- Displaying exact value in BASE SAS

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-19-2013 10:51 PM

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-20-2013 01:51 AM

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-20-2013 04:23 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-20-2013 05:43 AM

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 --<-----

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2013 12:06 PM

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)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-25-2013 02:37 PM

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

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

Good luck.