- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't know how the data is being used. We sent the data to downstream application for their usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.