NLDATM Function
Converts the SAS datetime value to the time value
of the specified locale by using the datetime-format descriptors.
Syntax
NLDATM(datetime,descriptor)
Required Arguments
- datetime
-
specifies a SAS datetime
value.
- descriptor
-
is a variable or expression
that specifies how dates and times are formatted in output. The following
descriptors are case sensitive:
- #
-
removes the leading
zero from the result.
- %%
-
specifies the % character.
- %a
-
specifies the short-weekday
descriptor. The range for the day descriptor is Mon–Sun.
- %A
-
specifies the long-weekday
descriptor. The range for the long-weekday descriptor is Monday–Sunday.
- %b
-
specifies the short-month
descriptor. The range for the short-month descriptor is Jan–Dec.
- %B
-
specifies the long-month
descriptor. The range for the long-month descriptor is January–December.
- %c
-
specifies the long-month
descriptor and uses blank padding. The range for the long-month descriptor
is January–December.
- %d
-
specifies the day descriptor
and uses 0 padding. The range for the day descriptor is 01–31.
- %e
-
specifies the day descriptor
and uses blank padding. The range for the day descriptor is 01–31.
- %F
-
specifies the long-weekday
descriptor and uses blank padding. The range for the day descriptor
is Monday–Sunday.
- %H
-
specifies the hour
descriptor that is based on a 24-hour clock. The range for the hour
descriptor is 00–23.
- %I
-
specifies the hour
descriptor that is based on a 12-hour clock. The range for the hour
descriptor is 01–12.
- %j
-
specifies the day-of-year
descriptor as a decimal number and uses a leading zero. The range
for the day-of-year descriptor is 1–366.
- %m
-
specifies the month
descriptor and uses 0 padding. The range for the month descriptor
is 01–12.
- %M
-
specifies the minute
descriptor. The range for the minute descriptor is 00–59.
- %o
-
specifies the month
descriptor and uses blank padding. The range for the month descriptor
is 1–12.
- %p
-
specifies a.m. or p.m.
descriptor.
- %S
-
specifies the second
descriptor. The range for the second descriptor is 00–59.
- %u
-
specifies the weekday
descriptor as a number in the range of 1–7 that represents
Monday–Sunday.
- %U
-
specifies the week-number-of-year
descriptor by calculating the descriptor value as the SAS date value
and uses the number-of-week value within the year (Sunday is considered
the first day of the week). The number-of-week value is represented
as a decimal number in the range 0–53. A leading zero and a
maximum value of 53 is used.
- %V
-
specifies the week-number-of-year
descriptor by calculating the descriptor value as the SAS date value.
The number-of-week value is represented as a decimal number in the
range 01–53. A leading zero and a maximum value of 53 is used.
Weeks begin on a Monday and week 1 of the year is the week that includes
both January 4th and the first Thursday of the year. If the first
Monday of January is the 2nd, 3rd, or 4th, the preceding days are
part of the last week of the preceding year.
- %w
-
specifies the weekday
descriptor as a number in the range of 0–6 that represents
Sunday–Saturday.
- %W
-
specifies the week-number-of-year
descriptor by calculating the descriptor value as SAS date value using
the number of week within the year (Monday is considered the first
day of the week). The number-of-week value is represented as a decimal
number in the range of 0–53. A leading zero and a maximum value
of 53 are used.
- %y
-
specifies the year
(2-digit) descriptor. The range for the year descriptor is 00–99.
- %Y
-
specifies the year
(4-digit) descriptor. The range for the year descriptor is 1970–2069.
Details
The NLDATM function
converts the SAS datetime value to the datetime value of the specified
locale by using the datetime descriptors.
Example
The following example
shows a time (a.m or p.m.) that is created from a SAS datetime value.
|
|
|
|
time_ampm=nldatm('24Feb2003:12:39:43'dt,'%I%p');
|
|
time_ampm=nldatm('24Feb2003:12:39:43'dt,'%I%p');
|
|