Usage Note 8510: PROC FORMAT with PICTURE statement gives flexibility for DATE, TIME and DATETIME FORMATS
Beginning in Version 7, you can use PROC FORMAT and the PICTURE
statement to display many permutations for DATE, TIME, and DATETIME
values. The DATATYPE= option on the PICTURE statement specifies that
you can use directives in the picture as a template to format DATE, TIME, or DATETIME values. A list of directives is available on page
445 of the SAS Procedures Guide, Version 8.
For example:
1. The maximum width for the DATEw. format is 9. If you want
a 4-digit year and have delimiters, use:
proc format;
picture date11_ (default=11) other='%0d-%0b-%Y' (datatype=date);
run;
Formatted dates appear as "dd-mmm-yyyy". To produce a
2-digit year, use %0y rather than %Y.
2. DATETIMEw.d formats values as "ddmmmyyyy:hh:mm:ss.ss".
If you want values displayed as "mm/dd/yyyy hh:mm:ss",
use:
proc format;
picture dttime other='%0m/%0d/%0y %0H:%0M:%0S'
(datatype=datetime);
run;
Operating System and Release Information
SAS System | Base SAS | Microsoft Windows NT Workstation | 8 TS M0 | |
Microsoft Windows 2000 Server | 8 TS M0 | |
Microsoft Windows 95/98 | 8 TS M0 | |
Microsoft Windows 2000 Datacenter Server | 8 TS M0 | |
Microsoft Windows 2000 Professional | 8 TS M0 | |
Solaris | 8 TS M0 | |
OpenVMS VAX | 8 TS M0 | |
Microsoft Windows 2000 Advanced Server | 8 TS M0 | |
IRIX | 8 TS M0 | |
64-bit Enabled Solaris | 8 TS M0 | |
z/OS | 8 TS M0 | |
OS/2 | 8 TS M0 | |
HP-UX | 8 TS M0 | |
ABI+ for Intel Architecture | 8 TS M0 | |
CMS | 8 TS M0 | |
64-bit Enabled AIX | 8 TS M0 | |
64-bit Enabled HP-UX | 8 TS M0 | |
OpenVMS Alpha | 8 TS M0 | |
Tru64 UNIX | 8 TS M0 | |
AIX | 8 TS M0 | |
*
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.
Type: | Usage Note |
Priority: | |
Topic: | SAS Reference ==> Procedures ==> FORMAT Data Management ==> Manipulation and Transformation ==> Date and Time Data Management ==> Manipulation and Transformation ==> User Written Formats
|
Date Modified: | 2008-04-17 16:23:12 |
Date Created: | 2002-09-20 12:52:00 |