<?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: Time Editing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540570#M149136</link>
    <description>&lt;P&gt;I had tried datetime15. for number 1....but the underlying data is still stored with the seconds?&amp;nbsp; Is the datetime15. ok as I need to compare times later without seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 20:21:13 GMT</pubDate>
    <dc:creator>BCNAV</dc:creator>
    <dc:date>2019-03-05T20:21:13Z</dc:date>
    <item>
      <title>Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540563#M149133</link>
      <description>&lt;P&gt;A couple of small issues:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I have a datetime26.7 variable (flightdatetime) that has values like: 26SEP2018:00:51:48.0000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a new one that truncates the seconds....so I would have: 26SEP2018:00:51 as a datetime variable (no seconds)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I also have another datetime22.3 variable (flightdategmt) that looks like 26SEP2018:00:00:00.000.&amp;nbsp; There is also a variable called gmttime, which is &lt;U&gt;character&lt;/U&gt;. An example is 0051. I need to be able to add the 0051 to&amp;nbsp;flightdatetimegmt so it will read, as a datetime,&amp;nbsp;26SEP2018:00:51 (no seconds).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540563#M149133</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2019-03-05T20:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540566#M149134</link>
      <description>&lt;OL&gt;
&lt;LI&gt;use format datetime15.&lt;/LI&gt;
&lt;LI&gt;Convert the character 0051 to a numeric 51, then add 51*60 seconds (which is 51 minutes) to your &lt;SPAN&gt;flightdategmt&amp;nbsp;&lt;/SPAN&gt;value, and then use format datetime15.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;See the documentation for the datetime format&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n0av4h8lmnktm4n1i33et4wyz5yy.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=n0av4h8lmnktm4n1i33et4wyz5yy.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540566#M149134</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-05T20:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540570#M149136</link>
      <description>&lt;P&gt;I had tried datetime15. for number 1....but the underlying data is still stored with the seconds?&amp;nbsp; Is the datetime15. ok as I need to compare times later without seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540570#M149136</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2019-03-05T20:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540571#M149137</link>
      <description>&lt;P&gt;You can do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
   dt='26SEP2018:00:51:48.0000000'dt;
   dtnew=dt;
   format dt datetime26.7 dtnew datetime15.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test2;
   flightdategmt='26SEP2018:00:00:00.000'dt;
   gmttime='0051';
   new_flightdategmt=sum(flightdategmt, input(cats(substr(gmttime, 1, 2), '.', substr(gmttime, 3, 2)), time5.));
   format flightdategmt datetime22.3 new_flightdategmt datetime15.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540571#M149137</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-05T20:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540572#M149138</link>
      <description>&lt;P&gt;Formats do not change the underlying data. They change the appearance when a human looks at it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really want the date and time in minutes, with seconds forced to be zero, you'd have to change the underlying data, or do the comparisons so seconds are ignored. All of this is simple math.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To take any datetime with seconds, and "round down" to the exact minute where seconds are forced to be zero:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newdatetime = 60*floor(datetime/60);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540572#M149138</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-05T20:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540576#M149140</link>
      <description>A format does not change data, only what you see. You can use intnx to “round" the value.</description>
      <pubDate>Tue, 05 Mar 2019 20:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540576#M149140</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-05T20:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Time Editing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540596#M149152</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142314"&gt;@BCNAV&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;A couple of small issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. I have a datetime26.7 variable (flightdatetime) that has values like: 26SEP2018:00:51:48.0000000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to create a new one that truncates the seconds....so I would have: 26SEP2018:00:51 as a datetime variable (no seconds)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Example using INTX to round to minutes:&lt;/P&gt;
&lt;PRE&gt;data example;
 x='26SEP2018:00:51:48.0000000'dt;
 y=intnx('minute',x,0,'B');
 format x y datetime26.7;
run;&lt;/PRE&gt;
&lt;P&gt;to do similar with a character value adding 51 minutes:&lt;/P&gt;
&lt;PRE&gt;data example;
 x='26SEP2018:00:00:0.0000000';
 y=put (intnx('minute',input(x,datetime27.7),51,'B'), datetime27.7);

run;&lt;/PRE&gt;
&lt;P&gt;use the appropriate format/informat for your need.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 21:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-Editing/m-p/540596#M149152</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-05T21:22:40Z</dc:date>
    </item>
  </channel>
</rss>

