<?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 How to correctly convert from datetime to date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-convert-from-datetime-to-date/m-p/267533#M52888</link>
    <description>&lt;P&gt;I'm having trouble converting from a DATETIME20. format to a MMDDYY10. format. Whenever I try to to edit my table with PROC SQL code (or equivalent PROC DATASETS code) such as the one given here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;alter table table1&lt;BR /&gt;modify datetime_to_date&amp;nbsp;format=mmddyy10.;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All I get is a column full of '**********'s. I can convert to a numeric date format and can convert back to DATETIME20. all right but how can I permanently change the format to MMDDYY10. format correctly?&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2016 04:57:02 GMT</pubDate>
    <dc:creator>chris_nguyen</dc:creator>
    <dc:date>2016-05-02T04:57:02Z</dc:date>
    <item>
      <title>How to correctly convert from datetime to date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-convert-from-datetime-to-date/m-p/267533#M52888</link>
      <description>&lt;P&gt;I'm having trouble converting from a DATETIME20. format to a MMDDYY10. format. Whenever I try to to edit my table with PROC SQL code (or equivalent PROC DATASETS code) such as the one given here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;alter table table1&lt;BR /&gt;modify datetime_to_date&amp;nbsp;format=mmddyy10.;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All I get is a column full of '**********'s. I can convert to a numeric date format and can convert back to DATETIME20. all right but how can I permanently change the format to MMDDYY10. format correctly?&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 04:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-convert-from-datetime-to-date/m-p/267533#M52888</guid>
      <dc:creator>chris_nguyen</dc:creator>
      <dc:date>2016-05-02T04:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly convert from datetime to date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-convert-from-datetime-to-date/m-p/267537#M52890</link>
      <description>&lt;P&gt;You need to do a calculation. A datetime is the number of seconds from Jan 1, 1960, while a date variable is the number of days.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do the conversion you can use the datepart() function in a proc sql or data step, but not in proc datasets or via an alter table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just want to change the display format of your data you can use DTDATE9. or a format in that family. Unfortunately I don't think there's one that matches the format you want though you can always create your own if you'd like, see Picture formats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 05:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-correctly-convert-from-datetime-to-date/m-p/267537#M52890</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-02T05:45:08Z</dc:date>
    </item>
  </channel>
</rss>

