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

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
SASKiwi
PROC Star

The correct option to use is DBSASTYPE:

https://documentation.sas.com/?docsetId=acreldb&docsetTarget=n0v4ma1zb9lu99n1728j279rjcqi.htm&docset...

 

DBTYPE is used when creating database tables.

supp
Pyrite | Level 9
Thanks @SASKiwi, this was it! Thanks for the explanation of the two options.

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 25. 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
  • 3 replies
  • 659 views
  • 4 likes
  • 3 in conversation