BookmarkSubscribeRSS Feed
keen_sas
Quartz | Level 8

Hi All , 

 

  I am trying to read an excel file into SAS with character variables having more than 10 decimal places and some of the cells has exponential values like 4.658535495689E-2, but after the excel is read i can see the decimal values in dataset only till 6 or 7th position only, but i want the complete decimal value to be displayed in the SAS dataset.There is no issue with the Length also, as some of the values are getting read completely ,but not all. Any options/methods to read the complete decimal values. Tried with inflie , libname statement also but could not retrieve all the decimal values from excel.

Some of the values present in excel are as below.

 

24.550898203592801
22.793831799922199
13.495276653171301
4.658535495689E-2
4.116260242164E-2
7.1999999999999995E-2

 

 

Below is the sample code used to retrieved.

proc import datafile="&path/&fname.xlsx"
dbms = xlsx out= data_ replace;
datarow=1;
getnames = yes;
run;

 

Any suggestions how to retrieve the complete decimal values from excel to SAS dataset.

2 REPLIES 2
Kurt_Bremser
Super User

Be aware that SAS works with 8-byte real numbers, which means that the precision is restricted to around 15 decimal digits.

 

Assign a long enough format like best32. so you can see all digits present in SAS.

ballardw
Super User

Run Proc Contents on the resulting data set to see the format. Likely  it will be BEST8. The values are likely therr, barring more than 15 decimals just not displaying. If you really care to see that many decimals change the formats to something you preferr like BEST32. of F24.16 or such.

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
  • 2 replies
  • 4940 views
  • 0 likes
  • 3 in conversation