Conditioning on a datetime field in a proc sql statment

Reply
Occasional Contributor
Posts: 5

Conditioning on a datetime field in a proc sql statment


Hi, I am trying to query a Sybase table in SAS using proc sql, and I want set a condition in my query on the datetime field.  When I do this get the error message

"ERROR: Expression using equals (=) has components that are of different data types."

My proc looks like this:

proc sql;

create table *** as

select

variable

from sb.table

where datefield = '8/20/2013 12:00:00.000 AM';

quit;

Does anyone know how to work around this error message? I have tride datetime(datefield) but it does not work. 

Thanks a bunch,

Respected Advisor
Posts: 4,922

Re: Conditioning on a datetime field in a proc sql statment

Change to where datefield = '20AUG2013:12:00:00'dt

PG

PG
Occasional Contributor
Posts: 5

Re: Conditioning on a datetime field in a proc sql statment

Awesome!! Thanks a ton PGStats!

Ask a Question
Discussion stats
  • 2 replies
  • 290 views
  • 0 likes
  • 2 in conversation