<?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: character date to Date9. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145461#M261945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS date and time values are stored as numbers, but displayed according to the chosen format. Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;format formatted_date date9. /* displays stored date value with specified format */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not_formatted_date best. /* number format */;&lt;/P&gt;&lt;P&gt;formatted_date = input ( chardate, MMDDYY10.); /* stores value as a SAS date value (number). Format determines which date format is used to display it. */&lt;/P&gt;&lt;P&gt;not_formatted_date = formatted_date; /* also a numeric value, but format displays it as a number */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jun 2014 19:42:06 GMT</pubDate>
    <dc:creator>Fugue</dc:creator>
    <dc:date>2014-06-18T19:42:06Z</dc:date>
    <item>
      <title>character date to Date9.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145458#M261942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose there is an easy fix for this, although I am new to SAS so it seems a little tricky at the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I have a date variable that is in character format ( $ 10) and looks like 06/31/2009, as an example. I would like to get that to date9. format if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 23:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145458#M261942</guid>
      <dc:creator>Hudson33</dc:creator>
      <dc:date>2014-06-17T23:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: character date to Date9.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145459#M261943</link>
      <description>&lt;P&gt;&lt;EM&gt;Editor's Note:&amp;nbsp; Thanks to Fugue for providing an example of how to use the INPUT function to convert a character date into&amp;nbsp;a SAS date and then using the FORMAT statement to apply the desired format.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Try this:

Data want;
set have;
format datevar date9.;
datevar = input ( chardate, MMDDYY10.);
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>Wed, 09 Nov 2016 20:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145459#M261943</guid>
      <dc:creator>Fugue</dc:creator>
      <dc:date>2016-11-09T20:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: character date to Date9.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145460#M261944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much! Would the same be the case for changing DATE9. to the numeric SAS date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2014 19:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145460#M261944</guid>
      <dc:creator>Hudson33</dc:creator>
      <dc:date>2014-06-18T19:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: character date to Date9.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145461#M261945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS date and time values are stored as numbers, but displayed according to the chosen format. Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;format formatted_date date9. /* displays stored date value with specified format */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; not_formatted_date best. /* number format */;&lt;/P&gt;&lt;P&gt;formatted_date = input ( chardate, MMDDYY10.); /* stores value as a SAS date value (number). Format determines which date format is used to display it. */&lt;/P&gt;&lt;P&gt;not_formatted_date = formatted_date; /* also a numeric value, but format displays it as a number */&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2014 19:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/145461#M261945</guid>
      <dc:creator>Fugue</dc:creator>
      <dc:date>2014-06-18T19:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: character date to Date9.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/330967#M261946</link>
      <description>My current character value is stored as ddmmmyyyy so I used date9. when changing it to the numeric value. The problem is that when I look at my data set the value for that variable is the SAS date. I tried using "format dateqol date9.;" to get it into the correct format, but I am getting the following error message: ERROR 48-59: The format $DATE was not found or could not be loaded.&lt;BR /&gt;What am I doing wrong? I put the format statement prior to the input statement. Thanks.</description>
      <pubDate>Wed, 08 Feb 2017 20:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/330967#M261946</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2017-02-08T20:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: character date to Date9.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/402040#M261948</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN class=""&gt;PaulaC,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Refer below code for your mentioned query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dateC;&lt;BR /&gt;input chardate :$9.;&lt;BR /&gt;datalines;&lt;BR /&gt;31dec1999&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data dateN;&lt;BR /&gt;set dateC;&lt;BR /&gt;format sasdate date9.;&lt;BR /&gt;sasdate=input(chardate,date9.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Placement of format statement does not affect at all.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Oct 2017 05:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/character-date-to-Date9/m-p/402040#M261948</guid>
      <dc:creator>P_trivedi</dc:creator>
      <dc:date>2017-10-07T05:23:53Z</dc:date>
    </item>
  </channel>
</rss>

