<?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: Transform time8. to $CHAR8. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410874#M100411</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99946"&gt;@csetzkorn&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I would like to transform a time8. Dataset column to a $CHAR8. Column to represent, for example, 15:47:39 as the same string/$CHAR8. Not SAS’s internal representation. I tried:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;SomeTime=put(SomeTime,time8.);
format SomeTime $CHAR8.;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in my dataset without success. Any ideas? Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You always have to create a new variable when you want to switch types.&lt;/P&gt;
&lt;P&gt;So you might do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have (rename=(sometime=_sometime));
length sometime $8;
sometime = put(_sometime,time8.);
drop _sometime;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Nov 2017 14:55:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-11-06T14:55:19Z</dc:date>
    <item>
      <title>Transform time8. to $CHAR8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410856#M100404</link>
      <description>&lt;P&gt;I would like to transform a time8. Dataset column to a $CHAR8. Column to represent, for example, 15:47:39 as the same string/$CHAR8. Not SAS’s internal representation. I tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SomeTime=put(SomeTime,time8.);
format SomeTime $CHAR8.;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my dataset without success. Any ideas? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410856#M100404</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-11-06T14:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Transform time8. to $CHAR8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410857#M100405</link>
      <description>&lt;P&gt;In general, it should not be necessary, as far as I can think of examples, to turn a SAS time (or date or datetime) value to a character variable. It seems like you are making your life difficult for yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, in your code, the variable SomeTime cannot be both numeric and character. It is numeric. If you want a character variable, you have to give it a different variable name.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410857#M100405</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-11-06T14:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Transform time8. to $CHAR8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410858#M100406</link>
      <description>&lt;P&gt;Two ways: use PUT or if the variable already has a format, you can use VVALUE to get the formatted valu:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A;
length str str2 $8;
format time time8.;
time = '15:47:39't;
str = put(time, time8.);
str2 = vvalue(time);
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410858#M100406</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-11-06T14:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Transform time8. to $CHAR8.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410874#M100411</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99946"&gt;@csetzkorn&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I would like to transform a time8. Dataset column to a $CHAR8. Column to represent, for example, 15:47:39 as the same string/$CHAR8. Not SAS’s internal representation. I tried:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;SomeTime=put(SomeTime,time8.);
format SomeTime $CHAR8.;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in my dataset without success. Any ideas? Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You always have to create a new variable when you want to switch types.&lt;/P&gt;
&lt;P&gt;So you might do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have (rename=(sometime=_sometime));
length sometime $8;
sometime = put(_sometime,time8.);
drop _sometime;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-time8-to-CHAR8/m-p/410874#M100411</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-06T14:55:19Z</dc:date>
    </item>
  </channel>
</rss>

