<?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 Changing STRING format INTO TIME format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57778#M16109</link>
    <description>Can someone help. I have a data with dates entered in STRING format. I will like to change in into the TIME format. I can do that in SPSS but failed to do it in SAS. The Data is in the form hh:MM:SS. When I checked the data using proc contents, it shows that the Times are in STRING format. This is how the data looks like: I tried to multiply TIME by 1, it did not work.&lt;BR /&gt;
&lt;BR /&gt;
Time&lt;BR /&gt;
10:20:30&lt;BR /&gt;
09:08:08&lt;BR /&gt;
09:06:50</description>
    <pubDate>Tue, 16 Feb 2010 10:10:29 GMT</pubDate>
    <dc:creator>TRUST</dc:creator>
    <dc:date>2010-02-16T10:10:29Z</dc:date>
    <item>
      <title>Changing STRING format INTO TIME format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57778#M16109</link>
      <description>Can someone help. I have a data with dates entered in STRING format. I will like to change in into the TIME format. I can do that in SPSS but failed to do it in SAS. The Data is in the form hh:MM:SS. When I checked the data using proc contents, it shows that the Times are in STRING format. This is how the data looks like: I tried to multiply TIME by 1, it did not work.&lt;BR /&gt;
&lt;BR /&gt;
Time&lt;BR /&gt;
10:20:30&lt;BR /&gt;
09:08:08&lt;BR /&gt;
09:06:50</description>
      <pubDate>Tue, 16 Feb 2010 10:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57778#M16109</guid>
      <dc:creator>TRUST</dc:creator>
      <dc:date>2010-02-16T10:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Changing STRING format INTO TIME format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57779#M16110</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
You can try the format time8. to convert the string to time number format.&lt;BR /&gt;
But keep in mind that the output here which you get as a number will be the number of seconds starting from 1 Jan 1960 00:00:00 &lt;BR /&gt;
data test;&lt;BR /&gt;
input timevar $10.;&lt;BR /&gt;
timenum=input(timevar,time8.);&lt;BR /&gt;
cards;&lt;BR /&gt;
10:20:30&lt;BR /&gt;
09:08:08&lt;BR /&gt;
09:06:50&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
run;&lt;BR /&gt;
Please check the following output.&lt;BR /&gt;
 10:20:30     37230&lt;BR /&gt;
 09:08:08     32888&lt;BR /&gt;
 09:06:50     32810&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Saurabh.</description>
      <pubDate>Tue, 16 Feb 2010 10:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57779#M16110</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-02-16T10:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Changing STRING format INTO TIME format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57780#M16111</link>
      <description>sorry it did not work. Currently the data that I have is in STRING FORMAT, I will like to convert it to TIME format. Sorry it did not work.</description>
      <pubDate>Tue, 16 Feb 2010 14:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57780#M16111</guid>
      <dc:creator>TRUST</dc:creator>
      <dc:date>2010-02-16T14:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Changing STRING format INTO TIME format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57781#M16112</link>
      <description>With SAS, your variables are either CHARACTER or NUMERIC type with an optional output FORMAT -- this can be identified with a PROC CONTENTS output report.  The code example provided should properly convert your CHARACTER variable data string to a SAS NUMERIC type variable, where you would then need to apply a SAS FORMAT statement in your code.&lt;BR /&gt;
&lt;BR /&gt;
If unsuccessful, suggest you share what SAS log you have demonstrating where the code is not working.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 16 Feb 2010 15:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57781#M16112</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-02-16T15:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Changing STRING format INTO TIME format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57782#M16113</link>
      <description>Thank you very much. It is working. I do really appreciate.</description>
      <pubDate>Tue, 16 Feb 2010 16:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Changing-STRING-format-INTO-TIME-format/m-p/57782#M16113</guid>
      <dc:creator>TRUST</dc:creator>
      <dc:date>2010-02-16T16:23:05Z</dc:date>
    </item>
  </channel>
</rss>

