HOUR Function

Returns the hour from a SAS time or datetime value.

Categories:Date and Time
CAS

Syntax

HOUR(time | datetime)

Required Arguments

time

is a numeric constant, variable, or expression that specifies a SAS time value.

datetime

is a numeric constant, variable, or expression that specifies a SAS datetime value.

Details

The HOUR function returns a numeric value that represents the hour from a SAS time or datetime value. Numeric values can range from 0 through 23. HOUR always returns a positive number.

Example

The following SAS statements produce this result:
SAS Statement
Result
now='1:30't;
h=hour(now);
put h;
 
1

See Also

Functions:
Last updated: March 16, 2017