<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic date-time informats in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36770#M9329</link>
    <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I want to read into a dataset date times which look like the following: Note especially that &lt;B&gt;9:45...AM has one integer before the ":" and 10:02...PM has two.&lt;/B&gt;&lt;BR /&gt;
26/01/2009 9:45:51 AM&lt;BR /&gt;
26/01/2009 10:02:08 PM&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Sachin</description>
    <pubDate>Thu, 18 Nov 2010 23:05:53 GMT</pubDate>
    <dc:creator>SachinRuk</dc:creator>
    <dc:date>2010-11-18T23:05:53Z</dc:date>
    <item>
      <title>date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36770#M9329</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I want to read into a dataset date times which look like the following: Note especially that &lt;B&gt;9:45...AM has one integer before the ":" and 10:02...PM has two.&lt;/B&gt;&lt;BR /&gt;
26/01/2009 9:45:51 AM&lt;BR /&gt;
26/01/2009 10:02:08 PM&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Sachin</description>
      <pubDate>Thu, 18 Nov 2010 23:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36770#M9329</guid>
      <dc:creator>SachinRuk</dc:creator>
      <dc:date>2010-11-18T23:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36771#M9330</link>
      <description>Have a look at the DATESTYLE= System option, first, for an appropriate setting to meet you data-input requirements.&lt;BR /&gt;
&lt;BR /&gt;
Then consider ANYDTDTM INFORMAT which should handle the dd/mm/yyyy appropriately.  Or alternatively, consider inputting the two date/time components individually with an INPUT statement, and then use the DHMS function to assign a SAS DATETIME variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
informats ANYDTDTM MDYAMPM site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
using dates and times site:sas.com</description>
      <pubDate>Fri, 19 Nov 2010 01:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36771#M9330</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-19T01:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36772#M9331</link>
      <description>Hi.&lt;BR /&gt;
I think SAS have some proper format can read it.&lt;BR /&gt;
Hope Someone can point it out.I have another curve way after lookup documentation for a long time.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
 input date : ddmmyy10.  time anydttme11.; &lt;BR /&gt;
 datetime=input(catx('/',put(date,date9.),put(time,timeampm11.)),datetime22.);&lt;BR /&gt;
 format datetime dateampm22.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
26/01/2009 9:45:51 AM&lt;BR /&gt;
26/01/2009 10:02:08 PM&lt;BR /&gt;
;run;&lt;BR /&gt;
proc print noobs;run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 19 Nov 2010 02:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36772#M9331</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-19T02:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36773#M9332</link>
      <description>thing is im doing this from a csv file. And those date-times exist in ONE column. So any suggestions as to how to pull it in from a csv itself. OR if not pull the column in as text and do what you did there?&lt;BR /&gt;
&lt;BR /&gt;
Sorry, Im just quite new to SAS&lt;BR /&gt;
&lt;BR /&gt;
Sachin</description>
      <pubDate>Fri, 19 Nov 2010 04:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36773#M9332</guid>
      <dc:creator>SachinRuk</dc:creator>
      <dc:date>2010-11-19T04:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36774#M9333</link>
      <description>OK.&lt;BR /&gt;
That would not be too complicated.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename csv 'c:\test.csv';&lt;BR /&gt;
data temp;                                       ;&lt;BR /&gt;
      infile csv delimiter = ','  lrecl=32767 firstobs=1;&lt;BR /&gt;
	   	informat datetime $30.;&lt;BR /&gt;
         input datetime; &lt;BR /&gt;
 _datetime=input(catx('/',put( input(scan(datetime,1,' '),ddmmyy10.)    ,date9.),put(  input(  catx(' ',scan(datetime,2,' '),scan(datetime,3,' '))  ,anydttme11.  )  ,timeampm11.)),datetime22.);         &lt;BR /&gt;
         format _datetime dateampm22. ;&lt;BR /&gt;
		 keep _datetime;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print noobs;run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 19 Nov 2010 07:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36774#M9333</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-19T07:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36775#M9334</link>
      <description>Did you read my reply and consider the appropriate INFORMAT approach to read your input file/cell?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 19 Nov 2010 14:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36775#M9334</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-19T14:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36776#M9335</link>
      <description>Ok.&lt;BR /&gt;
I can not understand enough for your said.&lt;BR /&gt;
Can you point out the proper formate to read this style of datetime ,&lt;BR /&gt;
I do not find the informat after look up documentation for a long time.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Mon, 22 Nov 2010 02:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36776#M9335</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-22T02:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36777#M9336</link>
      <description>The ANYDTDTM informat will not handle the AM/PM.  The MDYAMPM informat would do the trick, except it does not come in a DMY flavor.  Assuming you have no control over the structure of the value, I think that you are back to parsing the input line.</description>
      <pubDate>Mon, 22 Nov 2010 07:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36777#M9336</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-11-22T07:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: date-time informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36778#M9337</link>
      <description>Thanks for the correction, ArtC.  &lt;BR /&gt;
&lt;BR /&gt;
It appears that the DATESTYLE= system option is ignored for MDYAMPM and the AM|PM suffix string is ignored by the ANYDTDTM INFORMAT.  Also, there is a SAS tech note about ANYDTDTM which is unresolved on some OS platforms.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 22 Nov 2010 12:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/date-time-informats/m-p/36778#M9337</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-22T12:44:21Z</dc:date>
    </item>
  </channel>
</rss>

