<?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: How do I convert character time to numeric time? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365374#M86766</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input GCO$ AVB$ Event$;
datalines;
0800 1200 0300
;

data want;
	set have;
	num_GCO = input(GCO,hhmmss4.);
	num_AVB = input(AVB,hhmmss4.);
	num_Event = input(Event,hhmmss4.);
	format num: time.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Jun 2017 13:51:36 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-06-08T13:51:36Z</dc:date>
    <item>
      <title>How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365363#M86761</link>
      <description>&lt;P&gt;I have a data set with multiple time variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Time Variables:&amp;nbsp;GCO Time, AVB Time, Event Time, etc.&lt;/P&gt;&lt;P&gt;Times: 0800 1200 0300 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I input my data set it inputs those variables as character functions. However, I am going to need to add and subtract the times, so character format will not work. I have tried to change the format when the dataset inputs to a time format, however I recieve an error when&amp;nbsp;I do it that way. This should be an easy fix, just cant seem to find the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS Enterprise Guide 5.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365363#M86761</guid>
      <dc:creator>Amber_Nicole94</dc:creator>
      <dc:date>2017-06-08T13:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365370#M86764</link>
      <description>&lt;P&gt;You can't format a column as time format if its character as time and date are numeric. &amp;nbsp;To do it your way you would need to create a new numeric variable with the time5. format and input() the data into that:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  new_time=input(cats(char_time,"00"),hhmmss.);
  format new_time time5.;
run;&lt;/PRE&gt;
&lt;P&gt;Although I would first check how your getting the data in, is it some sort of import? &amp;nbsp;If so is it from Excel maybe? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:46:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365370#M86764</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-08T13:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365372#M86765</link>
      <description>&lt;P&gt;Or even simpler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;	new_time=input(char_time,hhmmss4.);
&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365372#M86765</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-06-08T13:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365374#M86766</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input GCO$ AVB$ Event$;
datalines;
0800 1200 0300
;

data want;
	set have;
	num_GCO = input(GCO,hhmmss4.);
	num_AVB = input(AVB,hhmmss4.);
	num_Event = input(Event,hhmmss4.);
	format num: time.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365374#M86766</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-08T13:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365376#M86767</link>
      <description>&lt;P&gt;input(cats(char_time,"00"),hhmmss.) worked perfectly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/365376#M86767</guid>
      <dc:creator>Amber_Nicole94</dc:creator>
      <dc:date>2017-06-08T13:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/462318#M117692</link>
      <description>&lt;P&gt;Hi, why did you use "00" and why wont it work with any other time format such as HHMM.? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 12:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/462318#M117692</guid>
      <dc:creator>kbelang1</dc:creator>
      <dc:date>2018-05-15T12:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert character time to numeric time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/462324#M117696</link>
      <description>&lt;P&gt;Please don't re-open old questions with new questions.&amp;nbsp; I add 00 so that the string is the correct format for the format I am using.&amp;nbsp; In the format the length is default 6, so 2 char for hour, and for min, and for sec.&amp;nbsp; As the data only has 4, 2 for hour, 2 for min, then I added 2 for second.&amp;nbsp; See&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s response on how to&amp;nbsp;&amp;nbsp;shorten the length so that adding seconds is not needed.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 12:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-convert-character-time-to-numeric-time/m-p/462324#M117696</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-15T12:31:14Z</dc:date>
    </item>
  </channel>
</rss>

