<?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: Converting time in Integer form to SAS time with milliseconds in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513063#M2484</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use HMS(&amp;lt;hours&amp;gt;,&amp;lt;minutes&amp;gt;,&amp;lt;seconds&amp;gt;) function. You may need to extract the hours carefully (adding leading zeros might help).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
format Time_Formated time12.6;
time=93501.5373;
Hr=input(substr(put(time,z11.4),1,2),2.);
Min=input(substr(put(time,z11.4),3,2),2.);
Sec=input(substr(put(time,z11.4),5),7.4);
Time_Formated=hms(Hr,Min,Sec);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Nov 2018 19:06:54 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2018-11-14T19:06:54Z</dc:date>
    <item>
      <title>Converting time in Integer form to SAS time with milliseconds</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513052#M2482</link>
      <description>&lt;P&gt;Hi, I currently have time variables listed in a table and have been trying to convert these time variables that are currently in decimal form to a Time12.6 format. For example, I would like 93501.5373 as 9:35:01.5373&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I have been using so far has cut off the millisecond numbers and only reported to the seconds:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test; set test;&lt;BR /&gt;new_time = input(put(time,$6.),hhmmss12.);&lt;BR /&gt;format test_time time12.6;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone has a solution that would be greatly appreciated. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 18:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513052#M2482</guid>
      <dc:creator>D_W</dc:creator>
      <dc:date>2018-11-14T18:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Converting time in Integer form to SAS time with milliseconds</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513054#M2483</link>
      <description>&lt;P&gt;Could it be that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put(time,$6.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;is where you lose the milliseconds?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 18:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513054#M2483</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-14T18:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Converting time in Integer form to SAS time with milliseconds</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513063#M2484</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use HMS(&amp;lt;hours&amp;gt;,&amp;lt;minutes&amp;gt;,&amp;lt;seconds&amp;gt;) function. You may need to extract the hours carefully (adding leading zeros might help).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
format Time_Formated time12.6;
time=93501.5373;
Hr=input(substr(put(time,z11.4),1,2),2.);
Min=input(substr(put(time,z11.4),3,2),2.);
Sec=input(substr(put(time,z11.4),5),7.4);
Time_Formated=hms(Hr,Min,Sec);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Nov 2018 19:06:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513063#M2484</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-14T19:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting time in Integer form to SAS time with milliseconds</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513071#M2485</link>
      <description>&lt;P&gt;No need to convert to characters, use math:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
format Time_Formated time12.6;
time=93501.5373;
Time_Formated=hms(floor(time/10000), floor(mod(time,10000)/100), mod(time,100));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Nov 2018 19:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513071#M2485</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-11-14T19:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Converting time in Integer form to SAS time with milliseconds</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513162#M2492</link>
      <description>&lt;P&gt;Thank you very much! This worked perfectly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 00:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-time-in-Integer-form-to-SAS-time-with-milliseconds/m-p/513162#M2492</guid>
      <dc:creator>D_W</dc:creator>
      <dc:date>2018-11-15T00:17:22Z</dc:date>
    </item>
  </channel>
</rss>

