YYWEEKUw. Format

Writes a week number in decimal format by using the U algorithm, excluding day-of-the-week information.
Category: Date and Time
Alignment: left

Syntax

YYWEEKUw.

Syntax Description

w
specifies the width of the output field.
Default:7
Range:3-8

Details

The YYWEEKUw. format writes a week-number format. The YYWEEKUw. format writes the various formats depending on the specified width. Algorithm U calculates the SAS date value by using the number of the week within the year (Sunday is considered the first day of the week).
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

Comparisons

The YYWEEKUw. format is similar to the WEEKUw. format except that the YYWEEKUw. format does not specify the day-of-week information. Also, the YYWEEKUw. format does not accept any width that is greater than 8.

Example

sasdate = '01JAN2007'd;
Statements
Results
----+----1----+
u=put(sasdate,yyweeku3.);
v=put(sasdate,yyweeku4.);
w=put(sasdate,yyweeku5.);
x=put(sasdate,yyweeku6.);
y=put(sasdate,yyweeku7.);
z=put(sasdate,yyweeku8.);
put u;
put v;
put w;
put x;
put y;
put z;
W00
W00
07W00
07W00
2007W00
2007-W00

See Also

Format: