Writes a week number in decimal format by using the W algorithm,
excluding the day-of-week information.
Category: |
Date and Time
|
Alignment: |
left
|
- w
-
specifies the width of the output field.
The YYWEEKWw. format writes
the various formats depending on the specified width. Algorithm W calculates
the SAS date value using the number of the week within the year.
Refer to the following table for widths, formats, and examples:
Widths |
Formats |
Examples |
3-4 |
Www |
W01 |
5-6 |
yyWww |
07W01 |
7 |
yyyyWww |
2007W01 |
8 |
yyyy-Www |
2007-W01 |
9-above |
invalid |
invalid |
The YYWEEKWw. format is similar
to the WEEKWw. format except that the YYWEEKWw. format does not specify the day-of-week information. Also,
the YYWEEKWw. format does not accept any width
that is greater than 8.
sasdate = '01JAN2007'd
Statements |
Results |
|
----+----1----+
|
u=put(sasdate,yyweekw3.);
v=put(sasdate,yyweekw4.);
w=put(sasdate,yyweekw5.);
x=put(sasdate,yyweekw6.);
y=put(sasdate,yyweekw7.);
z=put(sasdate,yyweekw8.);
put u;
put v;
put w;
put x;
put y;
put z;
|
W01
W01
07W01
07W01
2007W01
2007-W01
|
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.