Beginning in the fourth maintenance release of SAS® 9.4 (TS1M4), the ANYDTDTM informat does not correctly read values in the following form:
Jul 4, 2018 12:30:55 PM
The values can be read correctly if the "M" is removed from the AM or PM. Click the Full Code tab to see example code that illustrates this.
Click the Hot Fix tab in this note to access the hot fix for this issue.
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | Base SAS | z/OS | 9.4 TS1M4 | 9.4 TS1M6 |
z/OS 64-bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft® Windows® for x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8 Enterprise 32-bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8 Enterprise x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8 Pro 32-bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8 Pro x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8.1 Enterprise 32-bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8.1 Enterprise x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8.1 Pro 32-bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 8.1 Pro x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows 10 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows Server 2008 | 9.4 TS1M4 | |||
Microsoft Windows Server 2008 R2 | 9.4 TS1M4 | |||
Microsoft Windows Server 2008 for x64 | 9.4 TS1M4 | |||
Microsoft Windows Server 2012 Datacenter | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows Server 2012 R2 Datacenter | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows Server 2012 R2 Std | 9.4 TS1M4 | 9.4 TS1M6 | ||
Microsoft Windows Server 2012 Std | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Enterprise 32 bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Enterprise x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Home Premium 32 bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Home Premium x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Professional 32 bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Professional x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Ultimate 32 bit | 9.4 TS1M4 | 9.4 TS1M6 | ||
Windows 7 Ultimate x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
64-bit Enabled AIX | 9.4 TS1M4 | 9.4 TS1M6 | ||
64-bit Enabled Solaris | 9.4 TS1M4 | 9.4 TS1M6 | ||
HP-UX IPF | 9.4 TS1M4 | 9.4 TS1M6 | ||
Linux for x64 | 9.4 TS1M4 | 9.4 TS1M6 | ||
Solaris for x64 | 9.4 TS1M4 | 9.4 TS1M6 |
The ANYDTDTMw.d informat is flexible in the type of data values that it can read into SAS® datetime values. The INFORMAT statement below assigns this informat to read three variables. The values are missing in the fourth maintenance release of SAS 9.4 (TS1M4) and in the fifth maintenance release of SAS 9.4 (TS1M5).
The workaround is to remove the 'M' from AM|PM with the PRXCHANGE function and _INFILE_.
/* This code does not read the values correctly as it did in previous releases */
data work.test;
infile datalines dsd dlm=',';
informat SubmissionDate start end anydtdtm26.;
format SubmissionDate start end datetime.;
input SubmissionDate start end;
put (SubmissionDate start end) (=);
datalines;
"May 17, 2018 11:46:41 AM","May 14, 2018 11:25:25 AM","May 17, 2018 11:44:54 AM"
"Jun 5, 2018 4:30:21 PM","Jun 5, 2018 8:54:50 AM","Jun 5, 2018 10:30:03 AM"
;
run;
/* Workaround */
/* Store these two lines of data in a file on your machine */
"May 17, 2018 11:46:41 AM","May 14, 2018 11:25:25 AM","May 17, 2018 11:44:54 AM"
"Jun 5, 2018 4:30:21 PM","Jun 5, 2018 8:54:50 AM","Jun 5, 2018 10:30:03 AM"
filename myfile 'specify the path to the location where you stored the above lines of data' ;
data tmp3;
informat SubmissionDate start end anydtdtm32.;
infile myfile dsd;
format SubmissionDate start end datetime.;
/* remove the trailing M from each AM or PM in the input data record */
input @;
_infile_ = prxchange('s/( [AP])M/$1/', 3, _infile_);
input SubmissionDate start end;
run;
proc print;
run;
All values are missing for the first step while the ANYDTDTM informat is not reading values correctly. SubmissionDate=. start=. end=. SubmissionDate=. start=. end=. After PRXCHANGE is used on _INFILE_ to remove the "M" from AM|PM, these are the results from PROC PRINT: Obs SubmissionDate start end 1 17MAY18:11:46:41 14MAY18:11:25:25 17MAY18:11:44:54 2 05JUN18:16:30:21 05JUN18:08:54:50 05JUN18:10:30:03
A fix for this issue for Base SAS 9.4_M5 is available at:
https://tshf.sas.com/techsup/download/hotfix/HF2/B6Q.html#62567A fix for this issue for Base SAS 9.4_M4 is available at:
https://tshf.sas.com/techsup/download/hotfix/HF2/A3Z.html#62567Type: | Problem Note |
Priority: | high |
Topic: | SAS Reference ==> Informats ==> Date and Time ==> ANYDTDTM |
Date Modified: | 2018-07-26 15:33:57 |
Date Created: | 2018-07-03 09:08:44 |