Objective: convert a character variable to numeric with proc sql in sas
Conditions:
- The input variable has x lenght
- must keep all 0's in each position
- THERE ARE SOME FIELDS OF ONLY 0'S
Ex:
The table has one variable with the following:
'00000000'
'00000000'
'00000001'
'20170617'
'20151201'
The expected output is one variable with:
00000000
00000000
00000000
00000001
20170617
20151201
I tried:
PROC SQL;
CREATE TABLE AAA AS
SELECT input(field,z8.) as field_new
FROM input_table
QUIT;
But I get this undesired result:
0
0
0
00000001
20170617
20151201
Z8.
is aFORMAT
, not inINFORMAT
. – Tom