<?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: problems with conversion time hhmm5. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264841#M52005</link>
    <description>&lt;P&gt;What format does SAS show the variable as having? If the format is currently hhmm5 then the value is an actual SAS time value and you can change the format for display.&lt;/P&gt;
&lt;P&gt;But convert to what? There are a number of options. If you only want the&amp;nbsp;hour displayed&amp;nbsp;and no decimal portion then use HHMM2. or&amp;nbsp;HOUR2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a procedure that would be :&lt;/P&gt;
&lt;P&gt;Proc print data=have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var time;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format time hour2.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can change the format permanently in a variety of methods.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2016 17:05:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-04-19T17:05:14Z</dc:date>
    <item>
      <title>problems with conversion time hhmm5.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264837#M52003</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am trying to convert a variable that is in the format of h:mm:ss to hours. &amp;nbsp;I am not sure how to proceed. &amp;nbsp;It was a file converted to CSV and read-into SAS.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 16:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264837#M52003</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2016-04-19T16:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: problems with conversion time hhmm5.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264841#M52005</link>
      <description>&lt;P&gt;What format does SAS show the variable as having? If the format is currently hhmm5 then the value is an actual SAS time value and you can change the format for display.&lt;/P&gt;
&lt;P&gt;But convert to what? There are a number of options. If you only want the&amp;nbsp;hour displayed&amp;nbsp;and no decimal portion then use HHMM2. or&amp;nbsp;HOUR2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a procedure that would be :&lt;/P&gt;
&lt;P&gt;Proc print data=have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var time;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format time hour2.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can change the format permanently in a variety of methods.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 17:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264841#M52005</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-19T17:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: problems with conversion time hhmm5.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264842#M52006</link>
      <description>&lt;P&gt;So when I tried that proc print command, it says my arrtime variable is in a character format:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4804&amp;nbsp; Proc print ;&lt;/P&gt;&lt;P&gt;4805 &amp;nbsp; &amp;nbsp; var arrtime;&lt;/P&gt;&lt;P&gt;4806&amp;nbsp; &amp;nbsp; &amp;nbsp; format arrtime hour2.;&lt;/P&gt;&lt;P&gt;ERROR: You are trying to use the numeric format HOUR with the character variable arrtime in data set IAT.TIMETOIAT2.&lt;/P&gt;&lt;P&gt;4807&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 17:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264842#M52006</guid>
      <dc:creator>stancemcgraw</dc:creator>
      <dc:date>2016-04-19T17:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: problems with conversion time hhmm5.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264882#M52018</link>
      <description>&lt;P&gt;The you data did not have the format you stated, it had a $xx. format.&lt;/P&gt;
&lt;P&gt;Proc Contents data= datasetname; run;&lt;/P&gt;
&lt;P&gt;will tell the type and format of variables.&lt;/P&gt;
&lt;P&gt;Note that FORMAT has a very specific meaning when using SAS. FORMAT refers to how a value is displayed.&lt;/P&gt;
&lt;P&gt;Since you don't say how you read the data into SAS we can't address that but it is a very good idea to learn how to read dates and times into SAS date, time or datetime valued variables due to the number tools designed to work with them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the question could become: Are you trying to create a TIME valued variable, a character variable that has the hour from your chracter string of hh:mm:ss or create a numeric variable that has the number in the first position.&lt;/P&gt;
&lt;P&gt;In a data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; SAStimevar = input(arrtime,hhmmss.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Format SASTimeVar hhmmss.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; CharacterHour = scan(arrtime,1,':');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Numerichour = input(scan(arrtime,1,':'),best2.);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shows some ways to make one of each type of variable.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 19:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problems-with-conversion-time-hhmm5/m-p/264882#M52018</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-19T19:46:44Z</dc:date>
    </item>
  </channel>
</rss>

