Table 5.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 5.4: Frequently Used SAS Datetime and Time Formats
Format |
Value and |
Width |
Default |
|
---|---|---|---|---|
Example |
Description |
Range |
Width |
|
DATETIMEw.d |
|
ddmonyy:hh:mm:ss.ss |
7–40 |
16 |
17OCT91:14:25:32 |
||||
DTWKDATXw. |
|
day-of-week, dd month yyyy |
3–37 |
29 |
Thursday, 17 October 1991 |
||||
HHMMw.d |
TIMEPART( |
Hour and minute: |
2–20 |
5 |
14:26 |
hh:mm.mm |
|||
HOURw.d |
TIMEPART( |
Hour: hh.hh |
2–20 |
2 |
14 |
||||
MMSSw.d |
HMS(0,MINUTE( |
Minutes and seconds: |
2–20 |
5 |
25:32 |
mm:ss.ss |
|||
TIMEw.d |
TIMEPART( |
Time of day: hh:mm:ss.ss |
2–20 |
8 |
14:25:32 |
||||
TODw.d |
|
Time of day: hh:mm:ss.ss |
2–20 |
8 |
14:25:32 |