<?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 DateTime to Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611319#M178163</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302621"&gt;@Eugenio211&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;STRONG&gt;yymmdd10.&lt;/STRONG&gt; informat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; &lt;BR /&gt;&lt;BR /&gt;set have;
new_date=input(date_entered,yymmdd10.);
format new_date mmddyy10.;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2019 14:35:14 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-12-12T14:35:14Z</dc:date>
    <item>
      <title>Character DateTime to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611313#M178159</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me to convert a Character datetime type variable into a Date format? thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;2014-08-24 13:20:00.0000000 -04:00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this data step to convert character datetime to date, however it's not giving me the result I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want; set have;&lt;BR /&gt;new_date=input(date_entered,anydtdtm.);&lt;BR /&gt;format new_date mmddyy10.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting ********* as a result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611313#M178159</guid>
      <dc:creator>Eugenio211</dc:creator>
      <dc:date>2019-12-12T14:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Character DateTime to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611315#M178161</link>
      <description>&lt;P&gt;Add the datepart() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
date_entered = "2014-08-24 13:20:00.0000000 -04:00";
new_date = datepart(input(date_entered,anydtdtm.));
format new_date mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611315#M178161</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-12T14:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Character DateTime to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611319#M178163</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302621"&gt;@Eugenio211&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;STRONG&gt;yymmdd10.&lt;/STRONG&gt; informat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; &lt;BR /&gt;&lt;BR /&gt;set have;
new_date=input(date_entered,yymmdd10.);
format new_date mmddyy10.;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611319#M178163</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-12T14:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Character DateTime to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611320#M178164</link>
      <description>&lt;P&gt;Why did you use the INFORMAT (anydtDTM) that creates a datetime value if you wanted a date value?&lt;/P&gt;
&lt;P&gt;Just change the informat to one that generates a date value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; 
  set have;
  new_date=input(date_entered,anydtDTE.);
  format new_date mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611320#M178164</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-12T14:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Character DateTime to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611322#M178165</link>
      <description>&lt;P&gt;thanks so much, the datepart worked.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611322#M178165</guid>
      <dc:creator>Eugenio211</dc:creator>
      <dc:date>2019-12-12T14:37:25Z</dc:date>
    </item>
    <item>
      <title>Convert Character to Numeric to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613075#M179035</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert a character date data to numeric to date.&amp;nbsp; Can someone assist? thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example Data:&lt;/P&gt;&lt;P&gt;2015-04-07 14:35:00.0000000 -04:00&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 15:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613075#M179035</guid>
      <dc:creator>Eugenio211</dc:creator>
      <dc:date>2019-12-19T15:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613077#M179036</link>
      <description>&lt;P&gt;Didn't you ask this question a few days ago? You even marked the answer correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611322#M178165" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/611322#M178165&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 15:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613077#M179036</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-19T15:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613078#M179037</link>
      <description>&lt;P&gt;If you just want the DATE from that sting you can use the INPUT() function with the YYMMDD10. informat to just read the first 10 characters.&lt;/P&gt;
&lt;P&gt;Or did you instead want to generate the DATETIME value that the string represents?&amp;nbsp; If so do you really need to subtract the 4 hours that the tail end seems to indicate?&lt;/P&gt;
&lt;PRE&gt;647   data x;
648    string='2015-04-07 14:35:00.0000000 -04:00';
649    date1=input(string,yymmdd10.);
650    datetime1=input(string,anydtdtm28.);
651    format date1 yymmdd10.  datetime1 datetime20. ;
652    put (_all_) (=/);
653   run;


string=2015-04-07 14:35:00.0000000 -04:00
date1=2015-04-07
datetime1=07APR2015:14:35:00
&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Dec 2019 15:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613078#M179037</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-19T15:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613082#M179038</link>
      <description>&lt;P&gt;Thank you Tom.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 15:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613082#M179038</guid>
      <dc:creator>Eugenio211</dc:creator>
      <dc:date>2019-12-19T15:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character to Numeric to Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613142#M179039</link>
      <description>&lt;P&gt;I merged it back into the original thread, to keep all answers in one place.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 20:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-DateTime-to-Date/m-p/613142#M179039</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-19T20:41:23Z</dc:date>
    </item>
  </channel>
</rss>

