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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1321 views
  • 6 likes
  • 4 in conversation