Usage Note 34978: WEEK informat and format removed
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.
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.
Because the WEEK format and informat weren't documented, 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.
A sample of how to create a format to produce the week number from a SAS date is in the Full Code tab.
Operating System and Release Information
SAS System | Base SAS | OpenVMS on HP Integrity | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
z/OS | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
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 */
proc format;
picture week
low-high='%U'(Datatype=Date);
run;
data a;
x=today();
put x week.;
run;
/* The SAS log displays the week value */
Type: | Usage Note |
Priority: | |
Topic: | SAS Reference ==> Statements ==> Information ==> FORMAT SAS Reference ==> Statements ==> Information ==> INFORMAT
|
Date Modified: | 2010-11-12 11:29:47 |
Date Created: | 2009-02-27 13:09:06 |