<?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: Read time value in SAS of the form 515 as 5:15 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394498#M277919</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163953"&gt;@riya275&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You will need to convert your number into a SAS Time value for this to work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  timeAsNum=515;
  format timeAsSAS time5.;
  timeAsSAS=int(timeAsNum/100)*3600+mod(timeAsNum,100)*60;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 10 Sep 2017 10:59:10 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-09-10T10:59:10Z</dc:date>
    <item>
      <title>Read time value in SAS of the form 515 as 5:15</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394496#M277918</link>
      <description>&lt;P&gt;I have variable with time with &amp;nbsp;values like 515 which should be read like 5:15 To do this I used the following code-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data flights;
set cs.flights;
format sched_dep_time hhmm. dep_time hhmm. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but i get result for 515 as 0.09 which I think is the time it is calculating from 12:00 am in seconds . I also use time. format but no use. how do i deal with this?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Sep 2017 09:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394496#M277918</guid>
      <dc:creator>riya275</dc:creator>
      <dc:date>2017-09-10T09:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Read time value in SAS of the form 515 as 5:15</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394498#M277919</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163953"&gt;@riya275&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You will need to convert your number into a SAS Time value for this to work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  timeAsNum=515;
  format timeAsSAS time5.;
  timeAsSAS=int(timeAsNum/100)*3600+mod(timeAsNum,100)*60;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Sep 2017 10:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394498#M277919</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-10T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Read time value in SAS of the form 515 as 5:15</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394499#M277920</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163953"&gt;@riya275&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Actually.... If you're just interested how your numeric variable prints but you don't need it to be a SAS Time value then a Picture format could serve the purpose as well.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  picture numWithColon
    low-high = '00:00'
    ;
quit;

data test;
  format timeAsNum numWithColon4. timeAsSAS time5.;
  timeAsNum=515;

  timeAsSAS=int(timeAsNum/100)*3600+mod(timeAsNum,100)*60;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 214px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14945iE76FC179E3EC09CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Sep 2017 11:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394499#M277920</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-10T11:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Read time value in SAS of the form 515 as 5:15</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394544#M277921</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data flights;
set cs.flights;
sched_dep_time_t = hms(int(sched_dep_time/100), mod(sched_dep_time, 100), 0);
dep_time_t = hms(int(dep_time/100), mod(dep_time, 100), 0);
format sched_dep_time_t dep_time_t hhmm. ;
drop sched_dep_time dep_time;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Sep 2017 00:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394544#M277921</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-09-11T00:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Read time value in SAS of the form 515 as 5:15</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394558#M277922</link>
      <description>No I want to calculate the difference between two time periods , so I need sas to identify this as a time variable to use intck function .</description>
      <pubDate>Mon, 11 Sep 2017 03:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394558#M277922</guid>
      <dc:creator>riya275</dc:creator>
      <dc:date>2017-09-11T03:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Read time value in SAS of the form 515 as 5:15</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394559#M277923</link>
      <description>Sorry I had to comment this the answer above , your answer seems easy and workable , I'll definitely try it . Thanks a lot !</description>
      <pubDate>Mon, 11 Sep 2017 03:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-time-value-in-SAS-of-the-form-515-as-5-15/m-p/394559#M277923</guid>
      <dc:creator>riya275</dc:creator>
      <dc:date>2017-09-11T03:22:53Z</dc:date>
    </item>
  </channel>
</rss>

