<?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: char instead of date -why in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59585#M6069</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I misunderstood put-function principle, I thought it converts type of value (in documentation it is said: 'the PUT function returns a numeric value as a character string', so I decided it acts like converter...). Now I would use an explicit way of assigning format like you offered - there seems to be less points which can be mistaken) Thanks a lot for both advices&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Apr 2012 15:03:03 GMT</pubDate>
    <dc:creator>need_some_help</dc:creator>
    <dc:date>2012-04-11T15:03:03Z</dc:date>
    <item>
      <title>char instead of date -why</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59582#M6066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, everyone!&lt;/P&gt;&lt;P&gt;Recently I had to work with unix-timestamp data and found out one interesting thing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table work.why as&lt;/P&gt;&lt;P&gt;select put(dhms('01jan1970'd,4,0,1310018872/*unixtimestamp*/),datetime18.) as char_not_date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;lt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !!!*/&lt;/P&gt;&lt;P&gt;from sashelp.macrs7 where year=8 /*~dummy table*/;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'put' in a date-format gives me char... Why is that? What do I miss?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 14:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59582#M6066</guid>
      <dc:creator>need_some_help</dc:creator>
      <dc:date>2012-04-10T14:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: char instead of date -why</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59583#M6067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because that is what the put function does (see: &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199354.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199354.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199354.htm&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you want it to be a datetime?&amp;nbsp; If so, you could use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table work.why as&lt;/P&gt;&lt;P&gt;select input(put(dhms('01jan1970'd,4,0,1310018872/*unixtimestamp*/),datetime18.),datetime24.) as char_not_date format=datetime24.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;lt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !!!*/&lt;/P&gt;&lt;P&gt;from sashelp.macrs7 where year=8 /*~dummy table*/;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 15:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59583#M6067</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-04-10T15:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: char instead of date -why</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59584#M6068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PUT function always returns a string. That is what it is for. To display data in a given format.&lt;/P&gt;&lt;P&gt;If you want a datetime variable then remove the PUT() function and instead attach the format to the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;select dhms('01jan1970'd,4,0,1310018872) as datetime format=datetime18.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Why did you set the Hour to 4 AM?&lt;/P&gt;&lt;P&gt;You could also just add the seconds between 01JAN1970 and 01JAN1960.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;sasdt = unixdt - '01jan1960:00:00'dt + '01jan1970:00:00'dt ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 15:10:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59584#M6068</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-04-10T15:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: char instead of date -why</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59585#M6069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I misunderstood put-function principle, I thought it converts type of value (in documentation it is said: 'the PUT function returns a numeric value as a character string', so I decided it acts like converter...). Now I would use an explicit way of assigning format like you offered - there seems to be less points which can be mistaken) Thanks a lot for both advices&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 15:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/char-instead-of-date-why/m-p/59585#M6069</guid>
      <dc:creator>need_some_help</dc:creator>
      <dc:date>2012-04-11T15:03:03Z</dc:date>
    </item>
  </channel>
</rss>

