13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

814 Using TIME and TIMESTAMP 4 Chapter 28proc print data=prt.ORD;var name number;by name number;run;The above statement always yields identical ordering because every column isspecified in the BY clause. So your PROC PRINT output always looks the same.Using TIME and TIMESTAMPThis example creates a Teradata table and assigns the <strong>SAS</strong> TIME8. <strong>for</strong>mat to theTRXTIME0 column. Teradata creates the TRXTIME0 column as the equivalentTeradata data type, TIME(0), with the value of 12:30:55.libname mylib teradata user=testuser password=testpass;data mylib.trxtimes;<strong>for</strong>mat trxtime0 time8.;trxtime0 = ’12:30:55’t;run;This example creates a Teradata column that specifies very precise time values. The<strong>for</strong>mat TIME(5) is specified <strong>for</strong> the TRXTIME5 column. When <strong>SAS</strong> reads this column,it assigns the equivalent <strong>SAS</strong> <strong>for</strong>mat TIME14.5.libname mylib teradata user=testuser password=testpass;proc sql noerrorstop;connect to teradata (user=testuser password=testpass);execute (create table trxtimes (trxtime5 time(5))) by teradata;execute (commit) by teradata;execute (insert into trxtimesvalues (cast(’12:12:12’ as time(5)))) by teradata;execute (commit) by teradata;quit;/* You can print the value that is read with <strong>SAS</strong>/<strong>ACCESS</strong>. */proc print data =mylib.trxtimes;run;<strong>SAS</strong> might not preserve more than four digits of fractional precision <strong>for</strong> TeradataTIMESTAMP.This next example creates a Teradata table and specifies a simple timestamp columnwith no digits of precision. Teradata stores the value 2000-01-01 00:00:00. <strong>SAS</strong> assignsthe default <strong>for</strong>mat DATETIME19. to the TRSTAMP0 column generating thecorresponding <strong>SAS</strong> value of 01JAN2000:00:00:00.proc sql noerrorstop;connect to teradata (user=testuser password=testpass);execute (create table stamps (tstamp0 timestamp(0))) by teradata;execute (commit) by teradata;execute (insert into stampsvalues (cast(’2000--01--01 00:00:00’ as

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!