Previous Page | Next Page

Formats

WEEKVw. Format



Writes a week number in decimal format by using the V algorithm.
Category: Date and Time
Alignment: left

Syntax
Syntax Description
Details
Comparisons
Examples
See Also

Syntax

WEEKVw.

Syntax Description

w

specifies the width of the output field.

Default: 11
Range: 3-200

Details

The WEEKVw. 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 03W01
7-8 yyWwwdd 03W0101
9-10 yyyyWwwdd 2003W0101
11-200 yyyy-Www-dd 2003-W01-01


Comparisons

The WEEKVw. format writes the week number as a decimal number in the range 01-53, with weeks beginning on a Monday and week 1 of the year including 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. format writes the week number of the year as a decimal number in the range 00-53, with Monday as the first day of week 1. The WEEKUw. format writes the week number of the year (Sunday as the first day of the week) as a decimal number in the range 0-53, with a leading zero.


Examples

sasdate='01JAN2003'd; 

Statements Results

----+----1----+
v=put(sasdate,weekv3.);
w=put(sasdate,weekv5.);
x=put(sasdate,weekv7.);
y=put(sasdate,weekv9.);
z=put(sasdate,weekv11.);
put v;
put w;
put x;
put y;
put z;
W01
03W01
03W0103
2003W0103
2003-W01-03


See Also

Formats:

WEEKUw. Format

WEEKWw. Format

Functions:

WEEK Function

Informats:

WEEKUw. Informat

WEEKVw. Informat

WEEKWw. Informat

Previous Page | Next Page | Top of Page