Usage Note 37309: ANYDTDTM and MDYAMPM informats work together when the datetime value has AM|PM specified or day, month, and year components are not ambiguous
When a value is read with ANYDTDTMw. informat and the style of the value is dd/dd/dd(dd) tt:tt:tt AM|PM, the MDYAMPMw.d informat is called to read the value. If the AM|PM component is not present, the MDYAMPMw.d informat is used as long as the month and day components aren't ambiguous. If they are ambiguous, the value of the DATESTYLE= system option is used to determine the order of month, day, and year components.
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.1 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M0 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M0 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M0 | |
Microsoft Windows 2000 Server | 9.1 TS1M0 | |
Microsoft Windows 2000 Professional | 9.1 TS1M0 | |
Microsoft Windows NT Workstation | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M0 | |
Microsoft Windows XP Professional | 9.1 TS1M0 | |
64-bit Enabled AIX | 9.1 TS1M0 | |
64-bit Enabled HP-UX | 9.1 TS1M0 | |
64-bit Enabled Solaris | 9.1 TS1M0 | |
HP-UX IPF | 9.1 TS1M0 | |
Linux | 9.1 TS1M0 | |
OpenVMS Alpha | 9.1 TS1M0 | |
Tru64 UNIX | 9.1 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.
These examples illustrate how the ANYDTDTMw. informat reads values based upon an AM|PM specification and the DATESTYLE= system option.
/* Since AM is specified with the value, the ANYDTDTM informat */
/* is called to read the datetime value. */
options datestyle=dmy;
data test1;
format xtext $22. xdate DATETIME18.;
xtext="07/01/2008 12:30:00 AM";
xdate=input(xtext,ANYDTDTM30.);
proc print;
run;
/* Since AM|PM aren't specified and the month and day components */
/* are ambiguous, the DATESTYLE= system option is used to */
/* determine their order. */
options datestyle=dmy;
data test2;
format xtext $22. xdate DATETIME18.;
xtext="07/01/2008 12:30:00";
xdate=input(xtext,ANYDTDTM30.);
proc print;
run;
/* Notice the differences in XDATE based on the order of month and day */
Obs xtext xdate
1 07/01/2008 12:30:00 AM 01JUL08:00:30:00
1456
Obs xtext xdate
1 07/01/2008 12:30:00 07JAN08:12:30:00
Type: | Usage Note |
Priority: | |
Topic: | SAS Reference ==> Informats ==> Date and Time ==> ANYDTDTM Data Management ==> Manipulation and Transformation ==> Date and Time
|
Date Modified: | 2009-10-20 13:31:47 |
Date Created: | 2009-09-30 13:32:04 |