Date is formatted as such: 25JAN2018
and Time is formatted as such: 16:18:23
Trying to return a new field to where datetime is returned: 25JAN2018 16:18:23
I tried a cast function on both fields and attempted to combine and no such luck. Is there anyway to do this in PROC SQL?
Thanks in advance.
@PhatRam33 wrote:
It is in SQL pass-through. The date field is in date9 format I believe and the time field is in time8 format if that helps.
In that case you need to know which flavor of SQL your foreign database is using and find the appropriate command in that language. Are you using Oracle? Teradata? Redshift? Microsoft SQL Server? IBM ?? etc.
CAST() is not a SAS function, are you using SQL Pass through and are the fields SAS dates or character variables?
If it's SAS dates/times you can use the DHMS() function to compile the date and format as desired.
@PhatRam33 wrote:
Date is formatted as such: 25JAN2018
and Time is formatted as such: 16:18:23
Trying to return a new field to where datetime is returned: 25JAN2018 16:18:23
I tried a cast function on both fields and attempted to combine and no such luck. Is there anyway to do this in PROC SQL?
Thanks in advance.
It is in SQL pass-through. The date field is in date9 format I believe and the time field is in time8 format if that helps.
@PhatRam33 wrote:
It is in SQL pass-through. The date field is in date9 format I believe and the time field is in time8 format if that helps.
In that case you need to know which flavor of SQL your foreign database is using and find the appropriate command in that language. Are you using Oracle? Teradata? Redshift? Microsoft SQL Server? IBM ?? etc.
The language for the database is IBM DB2 I believe.
I figured it out. Once I found out the language of the database, the wheels started turning lol. Tom I give you credit though I totally missed this key question.
Was able to use the timestamp function with success:
timestamp(CREATE_DT, CREATE_TM) as CREATE_DT_TM
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.