BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5
I have one value 234782617327.23456
How to write informat and format for above value
4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

SAS numbers have a precision of 16 digits maximum.

So you will not be able to read or store this number and keep all the exact digits.

You can split the number if you still want to store as a number.

For example:

data _null_;
  file 'path\example.txt';
  put '234782617327.23456';
 run;

data WANT;
  infile 'path\example.txt';
  input;
  INT=input(      scan(_infile_,1,'.'),best16.);
  DEC=input('0.'||scan(_infile_,2,'.'),best16.);
run;

 

 

 

thanikondharish
Calcite | Level 5
Data ex1;
Input number $30.;
Cards;

234782617327.23456

;

How to convert character to numeric

Note: value should be same 234782617327.23456

#- Please type your reply above this line. No attachments. -##
ChrisNZ
Tourmaline | Level 20

@thanikondharish 

 

> value should be same

 

To repeat:

SAS numbers have a precision of 16 digits maximum.

 

You can read this page if you want to know more.

https://en.wikipedia.org/wiki/Floating-point_arithmetic

This sentence is the relevant part:

Double precision, usually used to represent the "double" type in the C language family (though this is not guaranteed). This is a binary format that occupies 64 bits (8 bytes) and its significand has a precision of 53 bits (about 16 decimal digits).

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 704 views
  • 0 likes
  • 3 in conversation