turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Last two digits changed when converting character ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2013 09:12 AM

I have a character variable with values of numbers (17-18 digits). I wanted to convert them into numeric. But the last two digits have changed for some reason.

The sas code I used is:

data convert;

set original;

numeric=input(character 18.0);

format numeric 18.0;

run;

Accepted Solutions

Solution

10-24-2013
09:57 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2013 09:57 AM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2013 09:57 AM

can't use more then 16 digits. refer this: http://support.sas.com/techsup/technote/ts654.pdf

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2013 09:59 AM

Even 16 digits is not safe. 2^53 (around 4x10^15) is the maximum storable number with full precision; so some Visa numbers may be storable, but no Mastercard numbers (5x10^15). This of course is often relevant with credit card numbers simply because they are right at that point of precision loss.

Solution

10-24-2013
09:57 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-24-2013 09:57 AM