Hello, I am connecting to a Teradata database. There are columns that I need to be numeric to perform calculations. In Teradata these columns are varchar(50). I have tried the 'dbtype' option with no luck:
LIBNAME teradata teradata server=server USER=user PASSWORD=password schema=schema;
data work.want; set teradata.have(dbtype=(COL_1='Numeric(3)')); run;
The program runs without error but COL_1 is still character, not numeric. I have also tried adding a format statement before the set statement
format COL_1 3.;
But then I get an error that COL_1 has been defined as both numeric and character.
How do I bring in COL_1 as numeric?
The correct option to use is DBSASTYPE:
DBTYPE is used when creating database tables.
The correct option to use is DBSASTYPE:
DBTYPE is used when creating database tables.
Play the rename/convert/drop game:
data work.want;
set teradata.have(rename=(COL_1=_col_1));
col_1 = input(_col_1, best32.);
drop _col_1;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.