Reputation: 63
I'm trying to convert an Oracle SQL statement to a SAS equivalent.
Here is the line in question in Oracle SQL
case when ((to_char(csm.csm_start_time, 'HH24MI') >= '0700' and
to_char(csm.csm_start_time, 'HH24MI') <= '1659')
The actual data is in this format: 2010-02-01 08:00:00
Is there a similar way to grab the 24 hour equivalent time from this date time field in one shot like the Oracle SQL version?
I know that the to_char
equivalent is PUT
and the closest format would probably be hhmm
. I'm not sure how to put it all together.
Upvotes: 0
Views: 581
Reputation: 63424
If it's a datetime field in SAS, you'd just want to use the HOUR function.
if hour(csm_start_Time) ge 7 and hour(csm_Start_time) lt 17
(or use in
or between
depending on the context).
Upvotes: 1