BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10
data have;
acct_number = 1000283639994;
run;

/*output*/
1.0002836E12

This is an example of an import of acct_numbers.  Some of the number produce an exponential number (see above).  What code can I insert to resolve the issue and show the entire number.

3 REPLIES 3
Reeza
Super User
Assign a Format.

format acct_number 32.;

FYI - things like Account Number where you will not do math on the field, you should store them as character.
Kurt_Bremser
Super User

An account number may be called a number, but you will never do calculations with it, so store it as character. This also prevents any possible issue with numeric precision.

Tom
Super User Tom
Super User

 

The default format SAS will use to display a number when you haven't told it do something else is BEST12.  Your number as nore than twelve digits, hence the use of scientific notation to represent it as best it can be in only 12 characters.

 

If you know the longest digit strings you have in that field are 13 characters then just tell SAS to use a different format to display the values.

data have;
  acct_number = 1000283639994;
  format acct_number 13.;
run;

What do you mean by "import"?

If the original file is just a text file, like a CSV file, then read this variable as character to begin with in addition to not having to worry about what format is used to display it you won't have to worry about losing data if the number of digits exceeds the maximum that floating point numbers can represent without having gaps.

 

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