Hello,
I have a CHAR column that has numbers in them 13 digits in length, I want to convert these to numeric but when I try to do this using INPUT I get a numeric column displaying the scientific format. I don't want this how do I go about stopping this?
This is what I am currently using,
PROC SQL;
CREATE TABLE WORK.ACCOUNT_NUMERIC as
SELECT *, INPUT (ACCOUNT, 16.) AS NUMERIC_ACCOUNT
What am i doing wrong?
The problem is not the informat, but the format. If you give the number the format you want, that should solve it, e.g.
PROC SQL;
CREATE TABLE WORK.ACCOUNT_NUMERIC as
SELECT *, INPUT (ACCOUNT, 16.) format=16.0 AS NUMERIC_ACCOUNT
INPUT (ACCOUNT, best32.)
Nope that didn't work.
Account Account_Numeric
1100001866320 1.1000019E12
1100002875975 1.1000029E12
1100004528978 1.1000045E12
1100009131297 1.1000091E12
This is a sample of the results I am getting
@Symun23 wrote:
Nope that didn't work.
Account Account_Numeric
1100001866320 1.1000019E12
1100002875975 1.1000029E12
1100004528978 1.1000045E12
1100009131297 1.1000091E12This is a sample of the results I am getting
If you don't do arithmetic with something it likely should not be numeric: postal codes, phone numbers, account numbers, product numbers, and patient identifiers for example. Then the issue should not have occurred at all.
The problem is not the informat, but the format. If you give the number the format you want, that should solve it, e.g.
PROC SQL;
CREATE TABLE WORK.ACCOUNT_NUMERIC as
SELECT *, INPUT (ACCOUNT, 16.) format=16.0 AS NUMERIC_ACCOUNT
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.