Desktop productivity for business analysts and programmers

EG4.3 - question about filtering using a datetime field

Reply
N/A
Posts: 1

EG4.3 - question about filtering using a datetime field

I'm new to SAS so forgive me if this has been answered elsewhere.  I didn't have any luck searching the forums.

My data set is coming from SQL server and the field is listed as DATETIME22.3.  When I try to filter on the date field, here is the error I receive:

PROC SQL;

CREATE TABLE WORK.QUERY_FOR_LOANNOTE AS

SELECT t1.LoanActNum,

t1.NoteTypeCd,

t1.LoanNote,

t1.LoanNum,

t1.StoreId,

t1.FinLocId,

t1.NoteDt,

t1.NotesNum

FROM CLST04.LoanNote t1

WHERE t1.NoteDt > '03Aug2011:12:30:00'dt AND t1.StoreId = 'AL102';

ERROR: CLI open cursor error: [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or

time from character string. : [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement(s) could not be prepared.

If I filter by the date only, (WHERE t1.NoteDt > '03Aug2011'd), that pulls back correctly.  I just can't figure out the correct syntax to also sort by time.

Thanks.

Ask a Question
Discussion stats
  • 0 replies
  • 158 views
  • 0 likes
  • 1 in conversation