<?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 Time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741836#M231963</link>
    <description>Suppose if the values are 0900 and 0930 I need the output as 09:00 and 09:30&lt;BR /&gt;Suggest me a solution</description>
    <pubDate>Mon, 17 May 2021 12:02:01 GMT</pubDate>
    <dc:creator>Sowmya12</dc:creator>
    <dc:date>2021-05-17T12:02:01Z</dc:date>
    <item>
      <title>Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741836#M231963</link>
      <description>Suppose if the values are 0900 and 0930 I need the output as 09:00 and 09:30&lt;BR /&gt;Suggest me a solution</description>
      <pubDate>Mon, 17 May 2021 12:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741836#M231963</guid>
      <dc:creator>Sowmya12</dc:creator>
      <dc:date>2021-05-17T12:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741840#M231965</link>
      <description>&lt;P&gt;Could you provide more information? Is the variable that contains 0900 and 0930 numeric or character? (I'm guessing character)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does 0900 represent 9 minutes and zero seconds, or is it 9 hours and 0 minutes?&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 12:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741840#M231965</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-17T12:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741843#M231967</link>
      <description>&lt;P&gt;What do you have now? Is that "0900" a character value? A number? What is the name of the variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If character you create a new variable that holds a SAS time value and assign a format: One way:&lt;/P&gt;
&lt;PRE&gt;data example;
  x='0900';
  numval = input(x,f4.);
  timevalue = hms(int(numval/100), mod(numval,100),0);
  format timevalue time5.;
run;&lt;/PRE&gt;
&lt;P&gt;The function hms needs a numeric hour, minute and second value. Since you don't have any seconds shown then that uses 0.&lt;/P&gt;
&lt;P&gt;If your current variable is numeric then skip the step that creates Numval.&lt;/P&gt;
&lt;P&gt;The format shows values in HH:MM format.&lt;/P&gt;
&lt;P&gt;You could drop Numval from the data.&lt;/P&gt;
&lt;P&gt;If your variable is a number you could use the name in both the places numval appears in the HMS function and the Timevalue variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 12:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741843#M231967</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-17T12:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741844#M231968</link>
      <description>Numeric</description>
      <pubDate>Mon, 17 May 2021 12:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741844#M231968</guid>
      <dc:creator>Sowmya12</dc:creator>
      <dc:date>2021-05-17T12:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741847#M231971</link>
      <description>&lt;P&gt;Numeric variables don't have leading zeros unless they are formatted. Can you please run PROC CONTENTS and confirm this variable is numeric, and tell us what the format is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You didn't answer my other question:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;Does 0900 represent 9 minutes and zero seconds, or is it 9 hours and 0 minutes?"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 12:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/741847#M231971</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-17T12:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/748610#M235107</link>
      <description>Hii&lt;BR /&gt;&lt;BR /&gt;Id time$&lt;BR /&gt;1 0900&lt;BR /&gt;2 0930&lt;BR /&gt;3 0825&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The time variable is in character and the output should be in time5.&lt;BR /&gt;Format.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Sowmya</description>
      <pubDate>Thu, 17 Jun 2021 05:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/748610#M235107</guid>
      <dc:creator>Sowmya12</dc:creator>
      <dc:date>2021-06-17T05:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time/m-p/748618#M235113</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/370687"&gt;@Sowmya12&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hii&lt;BR /&gt;&lt;BR /&gt;Id time$&lt;BR /&gt;1 0900&lt;BR /&gt;2 0930&lt;BR /&gt;3 0825&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The time variable is in character and the output should be in time5.&lt;BR /&gt;Format.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Sowmya&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Untested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  length time 8 helper $ 5;
  format time time5.;
  helper = cats(substr(timeStr, 1, 2), ':', substr(timeStr, 3, 2));
  time = input(helper, time.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 06:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time/m-p/748618#M235113</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-06-17T06:29:27Z</dc:date>
    </item>
  </channel>
</rss>

