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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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