BookmarkSubscribeRSS Feed
NareshAbburi
Calcite | Level 5

Hi,

I'm having hard time with date format of SAS to Teradata data upload.

My is as below.

here X is my Teradata library. Y is my SAS library

proc sql;

create table X.pace  as

select division_name, region_name, lob, bus_res,activity, fme , date, qty  from Y.pace;

run;

Date format is not as expected. how exactly should I select the query to pass the correct date format.

Thanks,

Naresh

6 REPLIES 6
Reeza
Super User

What do you expect a date to look like in Teradata?

How does it look like in SAS?

If you go to the MORE LIKE THIS section on the right hand side of the page on your question you'll see several answers to this common question.

NareshAbburi
Calcite | Level 5

Just DATE format.

kindly give me inputs.

Reeza
Super User

Teradata is most likely expecting a datetime variable not a date.

NareshAbburi
Calcite | Level 5

Thanks for your help. I really appreciate it.

TomKari
Onyx | Level 15

In your Y.pace table, does the "date" field have a date format attached? Sometimes SAS uses that as an indicator to create a different column format in the target database.

You can use this code to associate a date format with the variable:

proc datasets library=Y nolist;

modify pace;

format date date.;

quit;

If "date" is a datetime variable, use the datetime. format instead of date.

Tom

Tom
Super User Tom
Super User

Should work fine.  How is it different?

What  did the SAS log show?  Did you turn on displaying the generated Teradata SQL code?

libname X teradata server=&server username=&username password=&password

connection=global mode=teradata database=&userdb

;

data pace ;

  length  division_name region_name  lob  bus_res activity  fme $20 ;

  length  date qty  8;

  format date date9. ;

  informat date date9. ;

  input division_name -- qty ;

cards;

division_name region_name lob bus_res activity fme 09AUG2015 100

;;;;

data x.pace;

  set pace;

run;

data _null_;

set x.pace ;

put (_all_) (=/);

run;

division_name=division_name

region_name=region_name

lob=lob

bus_res=bus_res

activity=activity

fme=fme

date=09AUG2015

qty=100

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1343 views
  • 6 likes
  • 4 in conversation