<?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: changing character time  to numeric time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542849#M150038</link>
    <description>&lt;P&gt;I am just starting out in SAS so if my field I am converting is Beginning_Time. It would look like this??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; test&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   chartime&lt;SPAN class="token operator"&gt;= Beginning_Time&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token function"&gt;time&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;chartime&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;':'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;chartime&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; time5&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;time&lt;/SPAN&gt; timeampm7&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't quite learned how to insert code into the syntax quite yet&amp;nbsp; when I tried this in the Computed Column it just blew up on me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2019 15:59:37 GMT</pubDate>
    <dc:creator>drschoe</dc:creator>
    <dc:date>2019-03-13T15:59:37Z</dc:date>
    <item>
      <title>changing character time  to numeric time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542835#M150028</link>
      <description>&lt;P&gt;I am using information from my ods and we keep the class times in military time and as a character field (0800) and I would like to be able to switch that into a more friendly time for example 8:00 a.m.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I go about changing that by using Computed Column??/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542835#M150028</guid>
      <dc:creator>drschoe</dc:creator>
      <dc:date>2019-03-13T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: changing character time  to numeric time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542839#M150031</link>
      <description>&lt;P&gt;Hi and welcome to the SAS Communities &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   chartime='0800';
   time=input(cats(substr(chartime, 1, 2), ':', substr(chartime, 3, 2)), time5.);
   format time timeampm7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542839#M150031</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-13T15:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: changing character time  to numeric time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542849#M150038</link>
      <description>&lt;P&gt;I am just starting out in SAS so if my field I am converting is Beginning_Time. It would look like this??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; test&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   chartime&lt;SPAN class="token operator"&gt;= Beginning_Time&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token function"&gt;time&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;chartime&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;':'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;chartime&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; time5&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
   &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;time&lt;/SPAN&gt; timeampm7&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't quite learned how to insert code into the syntax quite yet&amp;nbsp; when I tried this in the Computed Column it just blew up on me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542849#M150038</guid>
      <dc:creator>drschoe</dc:creator>
      <dc:date>2019-03-13T15:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: changing character time  to numeric time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542851#M150039</link>
      <description>&lt;P&gt;You can do like this. Insert your data set name instead of&amp;nbsp;YourDatasetHere&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   set YourDatasetHere;
   time=input(cats(substr(Beginning_Time, 1, 2), ':', substr(Beginning_Time, 3, 2)), time5.);
   format time timeampm7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542851#M150039</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-13T16:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: changing character time  to numeric time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542859#M150046</link>
      <description>&lt;P&gt;Okay I put the info in as this for an advanced expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;set t2.BEGIN_TIME;&lt;BR /&gt;time=input(cats(substr(t2.BEGIN_TIME, 1, 2), ':', substr(t2.BEGIN_TIME, 3, 2)), time5.);&lt;BR /&gt;format time timeampm7.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I clicked validate and it gave me this back.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL NOEXEC;&lt;BR /&gt;SELECT (data test;&lt;BR /&gt;set t2.BEGIN_TIME;&lt;BR /&gt;time=input(cats(substr(t2.BEGIN_TIME, 1, 2), ':', substr(t2.BEGIN_TIME, 3, 2)), time5.);&lt;BR /&gt;format time timeampm7.;&lt;BR /&gt;run;) AS CALCULATION&lt;BR /&gt;FROM ODS_OPSU.SCHEDULE_OFFERING t1&lt;BR /&gt;INNER JOIN ODS_OPSU.MEETING_TIME t2 ON (t1.COURSE_IDENTIFICATION = t2.COURSE_IDENTIFICATION);&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 OPTION DEBUG=DBMS_SELECT SQL_IP_TRACE=(NOTE, SOURCE);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;4 PROC SQL NOEXEC;&lt;BR /&gt;5 SELECT (data test;&lt;BR /&gt;____&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, ), *, **, +, -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND,&lt;BR /&gt;BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||,&lt;BR /&gt;~, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;6 set t2.BEGIN_TIME;&lt;BR /&gt;__&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: MODE, TRANSACTION.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;7 time=input(cats(substr(t2.BEGIN_TIME, 1, 2), ':', substr(t2.BEGIN_TIME, 3, 2)), time5.);&lt;BR /&gt;____&lt;BR /&gt;180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;8 format time timeampm7.;&lt;BR /&gt;WARNING: This SAS global statement is not supported in PROC SQL. It has been ignored.&lt;BR /&gt;9 run;) AS CALCULATION&lt;BR /&gt;_&lt;BR /&gt;180&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;10 FROM ODS_OPSU.SCHEDULE_OFFERING t1&lt;BR /&gt;11 INNER JOIN ODS_OPSU.MEETING_TIME t2 ON (t1.COURSE_IDENTIFICATION = t2.COURSE_IDENTIFICATION);&lt;BR /&gt;12 QUIT;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;13 %PUT SQL_IPTRACE_RESULT=&amp;amp;SYS_SQL_IP_ALL;&lt;BR /&gt;SQL_IPTRACE_RESULT=-1&lt;BR /&gt;14 OPTIONS SQL_IP_TRACE=(NONE);&lt;BR /&gt;15 QUIT; RUN;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-time-to-numeric-time/m-p/542859#M150046</guid>
      <dc:creator>drschoe</dc:creator>
      <dc:date>2019-03-13T16:17:01Z</dc:date>
    </item>
  </channel>
</rss>

