sas 9.2, sql server 2008 r2,odbc=sql server native client 10.0
data destlib.tab; --sql server database
set sourcelib.tab; --local sas dataset
run
one column in sourcelib.tab is time8 type with values such as 17:37:33. after running the script above, the column in the sql server database has type datetime2(0) and the value becomes 1960-01-01 17:37:33.
another system
sas 9.4, sql server 2012, odbc=sql server native client 11.0
same script
the column in the sql server database becomes time(7) with the value 17:37:33.0000000
Could someone please tell me why the first scenario happens and where the control is? Thanks
Look at dataset option DBTYPE, something like data destlib.tab(DBTYPE =(myVar='time(7)'));
Hi PG
Thanks for your reply. Do you know why the first case happened? is it because of some sort of default option?
Thanks
Xiang
I don't know. To SAS, TIME. and DATETIME. are representations of the same quantity : the number of seconds since 01JAN1960:00:00:00. I guess things just got more sophisticated between versions 9.2 and 9.4.
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.
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.