With some research, Sarah managed to find an explanation in SAS usage note 34978. It tells an apparently odd tale:
For many years SAS did not have a format called WEEK. Customers often created user-defined formats with PROC FORMAT and used the format name of WEEK.The tale seems odd because SAS took the format away completely; one might have expected them to keep it, or to offer it with a different name. However, further research shows that SAS includes several other facilities for managing week number, including new formats:
Beginning in SAS 9.1, a SAS WEEKw. format and informat were implemented but mistakenly not documented. If a customer had created a user-defined format called WEEK and attempted to use it in a program, SAS used its format called WEEK rather than the user-defined format by the same name.
Since the WEEK format and informat weren't documented anyway, the decision was made to remove them from the software beginning in SAS 9.2. This decision allows legacy code, that includes a user-defined format called WEEK, to run as expected. Now, when customers create their own format called WEEK, they will use it when they reference the WEEK format in code.
If you simply want to produce the week number for a SAS date, here is some sample code.
/* PROC FORMAT with the PICTURE statement creates a custom format. The %U directive writes the week number of the year (Sunday as the first day of the week) with no leading zero.
Today's date is written out using the WEEK format */
picture week '%U'(Datatype=Date);
put x week.;
- The WEEK function - returns the week number value in varying styles
- WEEKU, WEEKV, and WEEKW formats and informats - reads and writes week numbers in varying styles
So, they took it away, but they didn't really! One might speculate that the WEEK format was added by a SAS staffer who wasn't aware of the other formats (and function). Anyway, if you're still on SAS V9.1 and you use the undocumented WEEK format or informat, you have been warned!