## Table - convert from character to numeric

Solved
Occasional Contributor
Posts: 10

# Table - convert from character to numeric

Hi!

I have a table where one one of the columns have character format.

How do I convert the values from character to numeric format with proc sql? Possible?

lca

Accepted Solutions
Solution
‎10-11-2011 11:20 AM
PROC Star
Posts: 8,164

## Table - convert from character to numeric

Is this what you are looking for?

data have;

informat x \$2.;

input x;

cards;

1

2

3

;

proc sql noprint;

create table want as

select input(x,2.) as x

from have

;

quit;

All Replies
Solution
‎10-11-2011 11:20 AM
PROC Star
Posts: 8,164

## Table - convert from character to numeric

Is this what you are looking for?

data have;

informat x \$2.;

input x;

cards;

1

2

3

;

proc sql noprint;

create table want as

select input(x,2.) as x

from have

;

quit;

New Contributor
Posts: 2

## Table - convert from character to numeric

I think you meant tthis code:

data have;

informat x \$2.;

input x;

cards;

1

2

3

;

proc sql noprint;

create table want as

select input(x,\$2.) as x

from have

;

quit;

Occasional Contributor
Posts: 10

## Table - convert from character to numeric

Yes. Worked. Thank you

PROC Star
Posts: 8,164

## Table - convert from character to numeric

chimanbj1 wrote: I think you meant tthis code: <snip>

No, I meant the code that I posted.  The OP wanted to convert character to numeric.

New Contributor
Posts: 2

## Table - convert from character to numeric

You are so right, Art! My mistake!

🔒 This topic is solved and locked.