Usage Note 22127: Determine the week of the year from a SAS date value
To determine the week of the year from a SAS date value, see this example from our sample programs section.
The WEEK function is available beginning with SAS 9.1.
WEEK(sas_date,descriptor)
sas_date specifies the SAS date value. If this value isn't specified, the
current date is used.
descriptor specifies the value of the descriptor.
U specifies the SAS date value by using the number-of-week 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 053
and uses a leading zero and a maximum value of 53.
V specifies the SAS date value. The number-of-week value is represented
as a decimal number in the range 0153 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 calculates the 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 053 and
uses a leading zero and a maximum value of 53.
International sites might be interested in the W descriptor because it uses Monday as the first day of the week rather than the default of Sunday.
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> DATA Step
|
Date Modified: | 2007-10-26 11:27:42 |
Date Created: | 2002-12-16 10:56:47 |