WEEKWw. Informat

Reads a value in the form of a week-number within the year and returns a SAS date value using the W algorithm.

Category: Date and Time

Syntax

WEEKWw.

Syntax Description

w

specifies the width of the input field.

Default 11
Range 3–200

Details

The WEEKWw. informat reads the week-number value within the year. If the input does not contain a year expression, the WEEKWw. informat uses the current year as the year expression, which is the default. If the input does not contain a day expression, the WEEKWw. informat uses the first day of the week as the day expression, which is the default. Algorithm W calculates the SAS date value using the number of the 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, with a leading zero and maximum value of 53. For example, the fifth week of the year would be represented as 05.
The inputs to the WEEKWw. informat are the same date for the following example. The current year is 2012.
Widths
Formats
Examples
3-4
Www
w01
5-6
yyWww
12W01
7-8
yyWwwdd
12W0101
9-10
yyyyWwwdd
2012W0101
11-200
yyyy-Www-dd
2012-W01-01

Comparisons

The WEEKWw. informat reads the week-number value as a decimal number in the range 00–53, with Monday as the first day of week.
The WEEKUw. informat reads the week-number value as a decimal number in the range 00–53, with Sunday as the first day of the week.
The WEEKVw. informat reads the week-number value as a decimal number in the range 01–53, with Monday as the first day of the week. Week one of the year is the week that includes both January fourth and the first Thursday of the year. If the first Monday of January is the second, third, or fourth, the preceding days are part of the last week of the preceding year.

Example

The current year is 2012 in the following examples.
Statements
Result
----+----1
v=input('W01',weekw3.);
w=input('03W01',weekw5.);
x=input('03W0101',weekw7.);
y=input('2003W0101',weekw9.);
z=input('2003-W01-01',weekw11.);
put v;
put w;
put x;
put y;
put z;





18994
18994
18994
18994
18994

See Also

Function:
WEEK Function in SAS Functions and CALL Routines: Reference