<?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 Re: Date 20110503 09:58:47.65 in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66508#M7711</link>
    <description>ok thanks :)

Message was edited by: Filipvdr</description>
    <pubDate>Wed, 18 May 2011 07:05:47 GMT</pubDate>
    <dc:creator>Filipvdr</dc:creator>
    <dc:date>2011-05-18T07:05:47Z</dc:date>
    <item>
      <title>Date 20110503 09:58:47.65</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66506#M7709</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I have a date like this: 20110503 09:58:47.65 (String format $48).&lt;BR /&gt;
How do I make this a Sas DateTime? ( the .65 can be dropped at the end )&lt;BR /&gt;
&lt;BR /&gt;
Thanks!

Message was edited by: Filipvdr</description>
      <pubDate>Tue, 17 May 2011 15:02:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66506#M7709</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-05-17T15:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Date 20110503 09:58:47.65</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66507#M7710</link>
      <description>data sample_data;&lt;BR /&gt;
	infile datalines;&lt;BR /&gt;
	input original_variable $48.;&lt;BR /&gt;
	datalines;&lt;BR /&gt;
	20110503 09:58:47.65&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data modified_data;&lt;BR /&gt;
	set sample_data;&lt;BR /&gt;
&lt;BR /&gt;
	*** separate date from original string  ***;&lt;BR /&gt;
	date=input(scan(original_variable,1,' '), yymmdd8.);&lt;BR /&gt;
&lt;BR /&gt;
	***  separate time from original string  ***;&lt;BR /&gt;
	time=scan(original_variable,-1,' ');&lt;BR /&gt;
&lt;BR /&gt;
	*** separate out hours minutes and seconds  ***;&lt;BR /&gt;
	hour=input(scan(time,1,':'),2.);&lt;BR /&gt;
	minute=input(scan(time,2,':'),2.);&lt;BR /&gt;
	second=input(scan(time,3,':'),2.);&lt;BR /&gt;
&lt;BR /&gt;
	***  create datetime variable ***;&lt;BR /&gt;
	datetime=dhms(date,hour,minute,second);&lt;BR /&gt;
&lt;BR /&gt;
	***  check work  ***;&lt;BR /&gt;
	datetime2=put(datetime,datetime.);&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 17 May 2011 17:17:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66507#M7710</guid>
      <dc:creator>AndyJ</dc:creator>
      <dc:date>2011-05-17T17:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date 20110503 09:58:47.65</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66508#M7711</link>
      <description>ok thanks :)

Message was edited by: Filipvdr</description>
      <pubDate>Wed, 18 May 2011 07:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66508#M7711</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-05-18T07:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Date 20110503 09:58:47.65</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66509#M7712</link>
      <description>[pre]&lt;BR /&gt;
options datestyle=ymd;&lt;BR /&gt;
data sample_data;&lt;BR /&gt;
infile datalines;&lt;BR /&gt;
input original_variable anydtdtm22.;&lt;BR /&gt;
format original_variable datetime20.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
20110503 09:58:47.65&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Thu, 19 May 2011 03:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66509#M7712</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-19T03:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date 20110503 09:58:47.65</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66510#M7713</link>
      <description>I found that using ANYDTDTM INFORMAT is inconsistent and sometimes unpredictable - splitting the two date-time components for INPUT and then combining them with DHMS (without manual parsing) works well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
1    data _null_;&lt;BR /&gt;
2    infile datalines;&lt;BR /&gt;
3    length tm_char $11;&lt;BR /&gt;
4    input dt_char $ tm_char $;&lt;BR /&gt;
5    dt = input(dt_char,yymmdd8.);&lt;BR /&gt;
6    tm = input(tm_char,time11.);&lt;BR /&gt;
7    dt_tm = dhms(dt,0,0,tm);&lt;BR /&gt;
8    format dt_tm datetime22.2;&lt;BR /&gt;
9    list;&lt;BR /&gt;
10   putlog _all_;&lt;BR /&gt;
11   datalines;&lt;BR /&gt;
&lt;BR /&gt;
tm_char=09:58:47.65 dt_char=20110503 dt=18750 tm=35927.65 dt_tm=03MAY2011:09:58:47.65 _ERROR_=0&lt;BR /&gt;
_N_=1&lt;BR /&gt;
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+&lt;BR /&gt;
12         20110503 09:58:47.65&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.02 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
13   run;</description>
      <pubDate>Thu, 19 May 2011 13:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66510#M7713</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-05-19T13:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Date 20110503 09:58:47.65</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66511#M7714</link>
      <description>thanks for your research, i'm using that one now and it goes good!</description>
      <pubDate>Fri, 20 May 2011 09:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Date-20110503-09-58-47-65/m-p/66511#M7714</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-05-20T09:59:01Z</dc:date>
    </item>
  </channel>
</rss>

