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