DHMS Function


Returns a SAS datetime value from date, hour , minute, and second

Category: Date and Time

Syntax

DHMS ( date,hour,minute,second )

Arguments

date

  • specifies a SAS expression that represents a SAS date value.

hour

  • is numeric.

minute

  • is numeric.

second

  • is numeric.

Details

The DHMS function returns a numeric value that represents a SAS datetime value. This numeric value can be either positive or negative.

Examples

The following SAS statements produce these results:

SAS Statements

Results

   dtid=dhms01jan03'd,15,30,15); put dtid; put dtid datetime.;   

1357054215 01JAN03:15:30:15

   dtid2=dhms('01jan03'd,15,30,61); put dtid2; put dtid2 datetime.;   

1357054261 01JAN03:15:31:01

   dtid3=dhms('01jan03'd,15,.5,15); put dtid3; put dtid3 datetime.;   

1357052445 01JAN02:15:00:45

The following SAS statements show how to combine a SAS date value with a SAS time value into a SAS datetime value. If you execute these statements on April 2, 2003 at the time of 15:05:02, it produces these results:

SAS Statements

Result

day=date();

 

time=time();

 

sasdt=dhms(day,0,0,time);

 

put sasdt datetime.;

02APR03:15:05:02

See Also

Function:

  • 'HMS Function' on page 578




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net