Reads the format of the number-of-week value within the year and
returns a SAS date value using the V algorithm.
-
w
-
specifies the width of the input field.
The WEEKVw.
informat reads a format of the number-of-week value. If the input does not
contain a year expression, WEEKVw. uses the current
year as the year expression, which is the default. If the input does not contain
a day expression, WEEKVw. uses the first day
of the week as the day expression, which is the default.
The V algorithm calculates the SAS date value. The number-of-week value
is represented as a decimal number in the range 01-53, with a leading
zero and 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. For example, the fifth week
of the year would be represented as 06.
The inputs to the WEEKVw. informat are
the same date for the following example. The current year is 2003.
Widths |
Formats |
Examples |
3-4 |
Www |
w01 |
5-6 |
yyWww |
03W01 |
7-8 |
yyWwwdd |
03W0101 |
9-10 |
yyyyWwwdd |
2003W0101 |
11-200 |
yyyy-Www-dd |
2003-W01-01 |
The WEEKUw. informat reads
the number-of-week value within the year. Sunday is the first day of the week,
as a decimal number in the range 0-53, with a leading zero. The WEEKVw. informat reads the number-of-week value as a decimal number
in the range 01-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. The WEEKWw. informat reads the week-number-of-year value as a decimal
number in the range 00-53, with Monday as the first day of week 1.
The current year is 2003 in the following examples.
Statements |
Results |
|
----+----1----+
|
v=input('W01',weekv3.);
w=input('03W01',weekv5.);
x=input('03W0101',weekv7.);
y=input('2003W0101',weekv9.);
z=input('2003-W01-01',weekv11.);
put v;
put w;
put x;
put y;
put z;
|
15704
15704
15704
15704
15704
|
|
Formats:
|
|
Functions:
|
|
Informats:
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.