BookmarkSubscribeRSS Feed
danfavero
Calcite | Level 5

Hello Everyone,

 

I have the following value in a variable '0.1234567890123456'. I need to create a numeric variable to keep exactly the same number as the text and tried a variety of formats. However, the closest I got was a numeric field with the number 0.12345678901234 (14 decimal places instead of 16)

 

Any hint to keep all 16?

 

Thanks!

 

 

5 REPLIES 5
Reeza
Super User

http://documentation.sas.com/?docsetId=lrcon&docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&docsetVer...

 

How did you import the data? It may be better to do it in the import stage than after the fact, since SAS isn't likely storing the numbers with 16 decimal places correctly in the first place. 

danfavero
Calcite | Level 5

I am importing as text exactly to keep all the 16 decimal places '0.1234567890123456'. However, when I create a numeric variable converting the text to numeric, I only can keep 14 decimal places 0.12345678901234.

 

I would like to confirm whether SAS has such a limitation or I can find any numeric format to keep all the 16 decimal places.

 

Thanks

Reeza
Super User

SAS has this limitation. Please see the link in my first response.

SASKiwi
PROC Star

Curious to know why you need 16 decimal places in the first place?

Tom
Super User Tom
Super User

If you need to store more digits than SAS can represent exactly using floating point numbers then you need to store them as character strings.

 

What type of arithmetic are you doing on these values?  Why do you think that the 16th least significant digit has any added value?

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
  • 3794 views
  • 0 likes
  • 4 in conversation