Previous Page | Next Page

Functions for NLS

NLDATE Function



Converts the SAS date value to the date value of the specified locale by using the date format descriptors.
Category: Date and Time

Syntax
Arguments
Details
Examples
See Also

Syntax

NLDATE(date,descriptor)


Arguments

date

specifies a SAS date 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 modifier 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.

%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.

%o

specifies the month descriptor. The range for the month descriptor is 1-12 with blank padding.

%u

specifies the weekday descriptor as a number in the range 1-7 that represents Monday-Sunday.

%U

specifies the week-number-of-year descriptor by calculating the descriptor value as the SAS date value using the number of week within the year (Sunday is considered the first day of the week). The number-of-the-week value is represented as a decimal number in the range 0-53 and uses a leading zero and a maximum value of 53.

%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 and uses a leading zero and a maximum value of 53. 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 0-6 that represents Sunday-Saturday.

%W

specifies the week-number-of-year descriptor by calculating the descriptor value as SAS date value by 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 0-53 and uses a leading zero and a maximum value of 53.

%y

specifies the year (2-digit) modifier. 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 NLDATE function converts the SAS date value to the date value of the specified locale by using the date descriptors.


Examples

The following example shows a log filename that is created from a SAS date value.

Statements Results
options locale=English_Unitedstates;

logfile=nldate('24Feb2003'd,'%B-%d.log');

put logfile;
February-24.log
options locale=German_Germany;

logfile=nldate('24Feb2003'd,'%B-%d.log');

put logfile;
Februar-24.log

The following example shows a weekday name that is created from a SAS date value.

Statements Results

----+----1----+
options locale=English_unitedstates;

weekname=nldate('24Feb2003'd,'%A');

put weekname;
Monday
options locale=German_Germany;

weekname=nldate('24Feb2003'd,'%A');

put weekname;
Montag


See Also

Format:

NLDATEw. Format

Previous Page | Next Page | Top of Page