BookmarkSubscribeRSS Feed
Satyakshma
Fluorite | Level 6
Hi,

I have Account_ID of length $36. I am trying to convert this to numeric variable but it truncates the last digits or converts the last digit to 0000. Kindly help with the issue.
2 REPLIES 2
ballardw
Super User

ID variables should not be numeric. Precision of storage is extremely likely to result in modified, i.e. rounded to fit the precision values.

 

Are you doing arithmetic with Id variables? Why? If you are not doing arithmetic then the variable should stay character.

Tom
Super User Tom
Super User

@Satyakshma wrote:
Hi,

I have Account_ID of length $36. I am trying to convert this to numeric variable but it truncates the last digits or converts the last digit to 0000. Kindly help with the issue.

You cannot convert a digit string with 36 characters into a number exactly.  The maximum integer that can be represented as a number in SAS before you start losing precision is:

23   data _null_;
24     max = constant('exactint');
25     put max= comma24.;
26   run;

max=9,007,199,254,740,992

So the maximum length digit string you can be sure will exactly be represented by a number is 15 digits.

 

You should not store ID values as numbers anyway.  You do not want to take the mean of the ID number.

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