Previous Page | Next Page

Formats for NLS

YYWEEKVw. Format



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

Syntax
Syntax Description
Details
Comparisons
Examples
See Also

Syntax

YYWEEKVw.


Syntax Description

w

specifies the width of the output field.

Default: 7
Range: 3-8

Details

The YYWEEKVw. format writes the various formats depending on the specified width. Algorithm V calculates the SAS date value, with the number-of-the-week value 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.

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 YYWEEKVw. format is similar to the WEEKVw. format except that the YYWEEKVw. format does not specify the day-of-week information. Also, the YYWEEKVw. format does not accept a width that is greater than 8.


Examples

sasdate = '01JAN2007'd;

Statements Results

----+----1----+
u=put(sasdate,yyweekv3.);
v=put(sasdate,yyweekv4.);
w=put(sasdate,yyweekv5.);
x=put(sasdate,yyweekv6.);
y=put(sasdate,yyweekv7.);
z=put(sasdate,yyweekv8.);
put u;
put v;
put w;
put x;
put y;
put z;
W01
W01
07W01
07W01
2007W01
2007-W01


See Also

Formats:

WEEKVw. Format

Previous Page | Next Page | Top of Page