<?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_ time split in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789959#M252875</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename x 'c:\temp\SCL.csv' encoding='utf8' termstr=crlf;
proc import datafile=x out=have dbms=csv replace;
guessingrows=max;
run;

data want;  
   set have;
   datevariable = datepart(Date_Time);
   timevariable = timepart(Date_Time);
   format datevariable date9. timevariable time8.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Jan 2022 12:14:29 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2022-01-13T12:14:29Z</dc:date>
    <item>
      <title>date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789878#M252825</link>
      <description>&lt;P&gt;My ultimate goal is to split the date and time into separate columns in the dataset attached below, please kindly help me out.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 04:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789878#M252825</guid>
      <dc:creator>otalog</dc:creator>
      <dc:date>2022-01-13T04:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789879#M252826</link>
      <description>&lt;P&gt;If you have an actual SAS datetime value (can't tell from a CSV as it is not a SAS dataset yet) the function DATEPART returns the date portion and the function TIMEPART returns the time portion such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;  
   set have;
   datevariable = datepart(datetimevariable);
   timevariable = timepart(datetimevariable);
   format datevariable date9. timevariable time8.;
run;&lt;/PRE&gt;
&lt;P&gt;Pick appropriate date format, your choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 04:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789879#M252826</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-13T04:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789880#M252827</link>
      <description>&lt;P&gt;Thanks for the quick reply, but please how do I read the file correctly into sas&amp;nbsp; before going ahead to split it?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 04:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789880#M252827</guid>
      <dc:creator>otalog</dc:creator>
      <dc:date>2022-01-13T04:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789927#M252859</link>
      <description>&lt;P&gt;See here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Software-for-Learning/DateTime-format-error/m-p/789919/highlight/true#M347" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Software-for-Learning/DateTime-format-error/m-p/789919/highlight/true#M347&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 09:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789927#M252859</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-13T09:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789959#M252875</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename x 'c:\temp\SCL.csv' encoding='utf8' termstr=crlf;
proc import datafile=x out=have dbms=csv replace;
guessingrows=max;
run;

data want;  
   set have;
   datevariable = datepart(Date_Time);
   timevariable = timepart(Date_Time);
   format datevariable date9. timevariable time8.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jan 2022 12:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789959#M252875</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-13T12:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789979#M252886</link>
      <description>&lt;P&gt;Just read the Date-Time column as a character string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename csv temp;
options parmcards=csv;
parmcards;
#RIC,Domain,Date-Time,Type,Price,Volume,Bid Price,Ask Price
0DZC.L,Market Price,2019-12-02T07:51:08.550270041Z,Quote,,,21.64,
0DZC.L,Market Price,2019-12-02T07:51:08.551068323Z,Quote,,,21.64,22.74
0DZC.L,Market Price,2019-12-02T08:11:47.326609096Z,Quote,,,21.4,22.74
0DZC.L,Market Price,2019-12-02T08:11:47.327322633Z,Quote,,,21.4,22.48
;

data have;
  length ric $10 domain $20 datetime $32 date time 8 type $10 price volume bid ask 8;
  infile csv dsd firstobs=2 truncover ;
  format date yymmdd10. time time15.6 ;
  input ric domain datetime type price volume bid ask;
  date = input(datetime,yymmdd10.);
  time = input(scan(datetime,2,'TZ'),time20.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-01-13 080735.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67375i93302CE8C96F5590/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-01-13 080735.jpg" alt="Screenshot 2022-01-13 080735.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 13:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/789979#M252886</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-13T13:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/790453#M253081</link>
      <description>Thanks for your reply, but please, after using the code and running with my entire data, most of the time variable do not appear.</description>
      <pubDate>Mon, 17 Jan 2022 05:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/790453#M253081</guid>
      <dc:creator>otalog</dc:creator>
      <dc:date>2022-01-17T05:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: date_ time split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/790455#M253083</link>
      <description>Thank you very much for the reply, the code works very well, but the datetime of this 2019-12-02T07:55:01.120950718+01 has missing time variable after spliting into date column and time column. So I wish to maintain the datetime format in the first row same as the second row, before spliting it into date and time. please how do I do it.&lt;BR /&gt;#RIC Domain Date-Time Type Bid Price Ask Price&lt;BR /&gt;0E64.L Market Price 2019-12-02T07:55:01.120950718Z Quote 79&lt;BR /&gt;0E64.L Market Price 2019-12-02T07:55:01.120950718+01 Quote 79 83&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Jan 2022 06:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-time-split/m-p/790455#M253083</guid>
      <dc:creator>otalog</dc:creator>
      <dc:date>2022-01-17T06:35:09Z</dc:date>
    </item>
  </channel>
</rss>

