## why the numeric value is different between Teradata and SAS?

Solved
Regular Contributor
Posts: 223

# why the numeric value is different between Teradata and SAS?

Hi All,

I have a column value in Teradata which is -999999999992240155, while the corresponding value in SAS is -999999999992240128.

Any insights why the values are different?

BTW, the data type in Teradata is decimal(18,0), the data type in SAS is numeric and format=19.

Thank you!

Accepted Solutions
Solution
‎04-23-2018 11:01 AM
Super User
Posts: 9,890

## Re: why the numeric value is different between Teradata and SAS?

Usually, when one encounters numbers with that many digits, they are not actual numbers, but some kind of code, in which case they should be kept in strings (character).

Keep in mind that the 15 digits of SAS can store the GNP of the US down to dimes, so that's sufficient for statistics.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

All Replies
Super User
Posts: 9,890

## Re: why the numeric value is different between Teradata and SAS?

All numbers in SAS dataset are stored in 8 bytes, real format (mantissa + exponent). Or less, if the length is reduced with a length statement.

That means that SAS can reliably store around 15 decimal digits. Any further digits will be lost or changed.

For further information, google for "sas numerical precision".

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Regular Contributor
Posts: 223

## Re: why the numeric value is different between Teradata and SAS?

Posted in reply to KurtBremser

Thank you so much KurtBremser! So the value -999999999992240155 is out of the valid range of SAS, right?

Is there any work around to deal with this situation? Or there is nothing we can do with it?

Thanks,

Solution
‎04-23-2018 11:01 AM
Super User
Posts: 9,890

## Re: why the numeric value is different between Teradata and SAS?

Usually, when one encounters numbers with that many digits, they are not actual numbers, but some kind of code, in which case they should be kept in strings (character).

Keep in mind that the 15 digits of SAS can store the GNP of the US down to dimes, so that's sufficient for statistics.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Regular Contributor
Posts: 223

## Re: why the numeric value is different between Teradata and SAS?

Posted in reply to KurtBremser

Thank you!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
• 4 replies
• 162 views
• 1 like
• 2 in conversation