<?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: converting DTWKDATX29. to a  worddate18. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256258#M49076</link>
    <description>&lt;P&gt;DTWKDATX means the valueis a datetime. So you want to extract the date portion using datepart(variablename) and then put that value or assign the format to a resulting variable.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 23:48:26 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-03-11T23:48:26Z</dc:date>
    <item>
      <title>converting DTWKDATX29. to a  worddate18.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256257#M49075</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a data filed that is&amp;nbsp;DTWKDATX29. what I need to do is this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt; select max(put("As Of Date"n),worddate18.) into :aofd from robm.STCD110a;&lt;BR /&gt; quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;get the max value into aofd how do I convert a&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;DTWKDATX29. to a &amp;nbsp;worddate18.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 23:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256257#M49075</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2016-03-11T23:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: converting DTWKDATX29. to a  worddate18.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256258#M49076</link>
      <description>&lt;P&gt;DTWKDATX means the valueis a datetime. So you want to extract the date portion using datepart(variablename) and then put that value or assign the format to a resulting variable.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 23:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256258#M49076</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-11T23:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: converting DTWKDATX29. to a  worddate18.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256454#M49152</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/7476"&gt;@robm﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expression&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;max(put("As Of Date"n),worddate18.)&lt;/PRE&gt;
&lt;P&gt;is syntactically incorrect (both closing parentheses should be at the end). Also, please note that with max(put(...)) you would select the "largest" &lt;EM&gt;formatted&lt;/EM&gt; value, i.e. the &lt;EM&gt;alphabetically&lt;/EM&gt; last value. Using this sort order together with the WORDDATE18. format, 'September 30, 2016' would be the "maximum" date of 2016 (and ' &amp;nbsp; &amp;nbsp; &amp;nbsp; May 1, 2016' the "minimum," due to right-alignment).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, I think you should use the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select put(datepart(max("As Of Date"n)),worddate18.) into :aofd trimmed
from robm.STCD110a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is,&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;select the latest among the non-missing datetime values&lt;/LI&gt;
&lt;LI&gt;extract the date part from this datetime value&lt;/LI&gt;
&lt;LI&gt;apply the WORDDATE18. format to the resulting date value&lt;/LI&gt;
&lt;LI&gt;trim leading (and trailing) blanks from the formatted value before it is written to macro variable AOFD&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;This assumes that "As Of Date"n is a numeric variable containing SAS datetime values and that you need a text such as 'January 5, 2016' in macro variable AOFD.&amp;nbsp;A datetime format (like DTWKDATX29.) that may be associated with &lt;SPAN&gt;"As Of Date"n is irrelevant here.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Mar 2016 22:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256454#M49152</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-13T22:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: converting DTWKDATX29. to a  worddate18.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256547#M49172</link>
      <description>&lt;P&gt;yeah! that worked perfectly thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2016 13:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-DTWKDATX29-to-a-worddate18/m-p/256547#M49172</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2016-03-14T13:51:21Z</dc:date>
    </item>
  </channel>
</rss>

