BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6
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
Fluorite | Level 6
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).

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1182 views
  • 0 likes
  • 3 in conversation