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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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