BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Symun23
Calcite | Level 5

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?

1 ACCEPTED SOLUTION

Accepted Solutions
s_lassen
Meteorite | Level 14

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

View solution in original post

5 REPLIES 5
Ksharp
Super User
INPUT (ACCOUNT, best32.)

Symun23
Calcite | Level 5

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

ballardw
Super User

@Symun23 wrote:

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


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. 

s_lassen
Meteorite | Level 14

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
Symun23
Calcite | Level 5
Thanks s_lassen, worked a treat

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1212 views
  • 0 likes
  • 4 in conversation