<?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 character to ddmmmyyyy date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/596085#M171584</link>
    <description>Thank you, I added "d" after '01JUN2019' in my original table and it worked</description>
    <pubDate>Sun, 13 Oct 2019 16:48:07 GMT</pubDate>
    <dc:creator>rick255</dc:creator>
    <dc:date>2019-10-13T16:48:07Z</dc:date>
    <item>
      <title>Converting character to ddmmmyyyy date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/595976#M171536</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS Enterprise version 7.15 HF8 (7.100.5.6214) (64-bit). I'm trying to change a date using data pulled from a Teradata server. The properties indicate the original field is Date9 and the output in SAS displays the dates as "ddmmmyyyy". I created a new table where I'm changing the date to "01JUN2019".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS identifies the new date as a character by default. When I try to change the field to Date9, the output is in numerical format and is displayed as "21701". I appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Have AS SELECT DISTINCT&lt;BR /&gt;'01JUN2019' AS START_DATE,&lt;BR /&gt;GROUP BY 1 ;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have&lt;BR /&gt;new = input(start_date, date9.);&lt;BR /&gt;drop start_date;&lt;BR /&gt;rename new=start_date;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2019 19:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/595976#M171536</guid>
      <dc:creator>rick255</dc:creator>
      <dc:date>2019-10-12T19:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Converting character to ddmmmyyyy date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/595983#M171540</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294896"&gt;@rick255&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using SAS Enterprise version 7.15 HF8 (7.100.5.6214) (64-bit). I'm trying to change a date using data pulled from a Teradata server. The properties indicate the original field is Date9 and the output in SAS displays the dates as "ddmmmyyyy". I created a new table where I'm changing the date to "01JUN2019".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS identifies the new date as a character by default. When I try to change the field to Date9, the output is in numerical format and is displayed as "21701". I appreciate any help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Have AS SELECT DISTINCT&lt;BR /&gt;'01JUN2019' AS START_DATE,&lt;BR /&gt;GROUP BY 1 ;QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have&lt;BR /&gt;new = input(start_date, date9.);&lt;BR /&gt;drop start_date;&lt;BR /&gt;rename new=start_date;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;'01JUN2019'&lt;/PRE&gt;
&lt;P&gt;is a string, while&lt;/P&gt;
&lt;PRE&gt;'01JUN2019'd&lt;/PRE&gt;
&lt;P&gt;is a valid date literal. To display a SAS date value (like 21701) in human-readable form, use a proper date format, e.g. date9.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2019 19:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/595983#M171540</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-12T19:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Converting character to ddmmmyyyy date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/595992#M171545</link>
      <description>&lt;P&gt;To make a date literal you need to add the letter D after the quoted string. To run a SELECT statement in PROC SQL you need to include a FROM clause.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note if you did successfully create a date value but just forgot to attach a date type format to it then the value is still a valid date value.&amp;nbsp; You just need to display it using the format.&amp;nbsp; The value 21,701 is the right value for the data '01JUN2019'd.&amp;nbsp; So just attach the format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note it is much easier to make simple datasets using SAS code instead of SQL code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  START_DATE = '01JUN2019'd;
  format START_DATE date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2019 20:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/595992#M171545</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-12T20:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Converting character to ddmmmyyyy date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/596085#M171584</link>
      <description>Thank you, I added "d" after '01JUN2019' in my original table and it worked</description>
      <pubDate>Sun, 13 Oct 2019 16:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-character-to-ddmmmyyyy-date/m-p/596085#M171584</guid>
      <dc:creator>rick255</dc:creator>
      <dc:date>2019-10-13T16:48:07Z</dc:date>
    </item>
  </channel>
</rss>

