> Peter -
>
> Based upon your earlier reply, is the following
> statement true: "Even if I apply a format like
> DTDATE9. it is necessary to treat the underlying
> value as a datetime value when applying a subseting
> if statment in a data step as it is not possible to
> use a date constant short of creating a new variable
> that contains only the datepart or extend a date
> constant into a datetime constant (example:
> "&date2:0:0:0"dt)."
I consider this true, as I think "&date2:0:0:0"dt will use that date constant correctly.
I think this extract
> ............................. it is not possible to
> use a date constant
is false
My reasoning for working with datetime values in data step or sql programming :
avoid functions (like datepart) that might cause an entire teradata or oracle table to be passed to SAS for processing.
It is neither difficult nor unclear (imho) to extend a sas date constant into a datetime constant.
If it is possible that the dbms column of datetime type might hold a time value as well as a date value, rather than seek equality with &date2:0:0:0"dt, we can use a range like
where dbms_datetime between "&sasdate:00:0"dt and "&sasdate:24:0:0"dt
in place of
where datepart( dbms_datetime) = "&sasdate"d