Hi,
I need to convert 25 length of character variable to numeric field in SAS.
Example :
I have field XYZ having data ='27201807000526_61135239'.
I want to create another NUMERIC variable ABC = 27201807000526_61135239'.
Is this possible? Since the length of the numeric is grater than 16.
An underscore isn't a numeric character so you won't get exactly what you seem to want. If you can explain why you need to convert this value to numeric might be able to offer an alternative strategy.
I don't know how the data is being used. We sent the data to downstream application for their usage.
@shuchidxt_gmail_com wrote:
I don't know how the data is being used. We sent the data to downstream application for their usage.
HOW do you send it?
SAS can store no more than 16 digits accurately, under certain conditions.
Integer numbers greater than 2**53 can get distorted.
For decimal numbers, the number of exact digits is 15 maximum.
These are for PC/Unix. Mainframes are more accurate (but store smaller exponent sizes).
You can't convert it to numeric, since it isn't a number. If I said I was going to give you 27201807000526_61135239 chicken feathers, how many chicken feathers is that?
Yes, I know that we cannot change it to numeric. I want to get assured that there is no way to convert it to numeric.
27201807000526_61135239 is not a number, therefore your question does not make sense. If you need to convert a part of this string to a number, then it's different, but you would need to tell us so.
If the underline is in fact the decimal point (or similar), the number would have too many digits for SAS and you would lose precision.
You could convert this string reliably to two separate numbers, OTOH.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.