I pulled this date from sql server and tried putting single quotes around it but that didn't work. I saw somewhere that %bquote was used so I tried that too. Any suggestions appreciated.
proc sql inobs=7;
connect to SQLSVR (user=&user. Password=&pass. dsn=&db.);
create table members as
select * from connection to SQLSVR
(
select *
from jkl.table1
where entered_dt >= '22OCT2018:07:00:00.0000000'
);
disconnect from sqlsvr;
quit;
Thanks
@RichardDeVen wrote:
Try
YYYY-MM-DDSo
where entered_dt >= '2018-11-22'
This works '2020-11-22 07:00:00'. Thanks for getting me on the right track.
Try
YYYY-MM-DD
So
where entered_dt >= '2018-11-22'
@RichardDeVen wrote:
Try
YYYY-MM-DDSo
where entered_dt >= '2018-11-22'
The query runs successfully but it doesn't give the correct answer. How do I find rows where the time is after 7AM on that date?
Thanks
@RichardDeVen wrote:
Try
YYYY-MM-DDSo
where entered_dt >= '2018-11-22'
If I change the datetime to '2020-10-22:07:00:00.0000000'
ERROR: CLI open cursor error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Conversion failed when converting
date and/or time from character string.
A Google search will provide the answer:
'2020-10-22 07:00:00'
@RichardDeVen wrote:
Try
YYYY-MM-DDSo
where entered_dt >= '2018-11-22'
This works '2020-11-22 07:00:00'. Thanks for getting me on the right track.
@DanD999 - Please mark the post as answered then.
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.