Datetime and Time Formats

Table 4.4 lists some of the available SAS datetime and time formats. For each format, the example shows the formatted value. The value of the variable dt is '17OCT91:14:25:32'DT. You can specify the width of each format by adding w. For formats that allow a decimal value, you can specify the number of decimal digits by adding d.

Table 4.4 Frequently Used SAS Datetime and Time Formats

Format

Value and

 

Width

Default

 

Example

Description

Range

Width

DATETIMEw.d

dt

ddmonyy:hh:mm:ss.ss

7–40

16

 

17OCT91:14:25:32

     

DTWKDATXw.

dt

day-of-week, dd month yyyy

3–37

29

 

Thursday, 17 October 1991

     

HHMMw.d

TIMEPART(dt)

Hour and minute:

2–20

5

 

14:26

hh:mm.mm

   

HOURw.d

TIMEPART(dt)

Hour: hh.hh

2–20

2

 

14

     

MMSSw.d

HMS(0,MINUTE(dt),SECOND(dt))

Minutes and seconds:

2–20

5

 

25:32

mm:ss.ss

   

TIMEw.d

TIMEPART(dt)

Time of day: hh:mm:ss.ss

2–20

8

 

14:25:32

     

TODw.d

dt

Time of day: hh:mm:ss.ss

2–20

8

 

14:25:32