BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PhilipH
Quartz | Level 8

Hello,

I got a numeric variable extracted from the Oracle DB that is set to numeric 8.

But the variable should be able to store 30 digits not just 18 or 19.

What would be the correct format that I need to apply?

I looked around for input and COMMA but that just created decimals.

Thanks for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Using SAS, you will have to bring in the field as character.  It's not a matter of finding a format (or an informat).  It's that SAS cannot accurately store numbers that large.  So even if you find a way to bring it in as numeric, SAS will change the value.

View solution in original post

3 REPLIES 3
Astounding
PROC Star

Using SAS, you will have to bring in the field as character.  It's not a matter of finding a format (or an informat).  It's that SAS cannot accurately store numbers that large.  So even if you find a way to bring it in as numeric, SAS will change the value.

PhilipH
Quartz | Level 8
hmhmmm that is interesting. thanks
Patrick
Opal | Level 21

Unlike Oracle SAS has only two data types: Character and Numeric.

 

In SAS a length of 8 for a numeric variable doesn't mean 8 digits but that SAS uses 8 Bytes to store the value. This allows to store numbers with full precision up to 15 digits.

 

The only way to store more than 15 digits with full precision in SAS is to use a character variable - which is o.k. as long as you only use this data categorical and don't want to actually do calculations with it. Most of the time that's what such many digits are: Some ID or Account number or the like.

 

The conversion to character needs to happen on the database side - a cast() function with Oracle. If you use the table with these numeric(n) datatypes often then consider to create a view in Oracle and implement the cast() there; else use SQL pass-through or use option dbsastype http://support.sas.com/documentation/cdl/en/acreldb/69580/HTML/default/viewer.htm#n0v4ma1zb9lu99n172...

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 7322 views
  • 2 likes
  • 3 in conversation