BookmarkSubscribeRSS Feed
Sanyam
Calcite | Level 5

I want to read a large floating point number from fixed position file and write it as the same value without rounding it.

Example:

Number starts from position 20 in the file. And the value is 999999999999.999999

I tried reading this value as

INPUT @20 num 19.6;


But the output it shows with or without the format 19.6 as :


1E12

1 REPLY 1
SASKiwi
PROC Star

SAS stores numbers in 8 bytes which can accurately hold around 16 digits including decimal places. Since SAS cannot precisely hold the 19 digits you are after you end up getting numbers slightly different to what you read. Try format 16.2.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 646 views
  • 0 likes
  • 2 in conversation