You're getting the right value originally.
The problem is with formatting. Add:
format acct_id 15.;
That should display ACCT_ID without scientific notation (assuming, as you say, that values are limited to 15 digits).
I don't see any possible reason why you'd want to convert ACCT_ID to a number anyway. You don't need it to be numeric, there's no such thing as performing arithmetic on an ACCT_ID, for example, to find the average ACCT_ID.
If your character accountid does have more than 15 digits, you must not do that, as you will lose precision in the conversion.
@nickspencer wrote:
Hi,
I am trying to convert a character variable to numeric but when I use input function it is returning me the numeric value in scientific notation. Is there a way I can get a proper value ?
I am using the input function as below
acct_id=input(accountid, 20.);
I tried the best32. informat. It still returns in the same format with scientific notation like 4.9975044E14
The original format/informat of the accountid shows $15.
Any help that will help me get the proper value will be appreciated. Thanks
Please tell us what you expect to do with a numeric version of the account id that you cannot do with a character version.
Please.
Maybe for space reasons. DB systems usually use 8 bytes for numbers, like SAS, so you save can 7 bytes.
As long as you can be sure that you never have more than 15 digits, you can store that reliably as a number.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.