<?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 Dates in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807603#M33638</link>
    <description>Hey Tom,&lt;BR /&gt;&lt;BR /&gt;I used this data step:&lt;BR /&gt;&lt;BR /&gt;data test;&lt;BR /&gt;set  hello;&lt;BR /&gt;AppDate1 = put(datepart(AppDate),date9.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;AppDate1 comes out as desired (20DEC2019) but it gets converted into a character varaible and I need it as a date.</description>
    <pubDate>Wed, 13 Apr 2022 14:22:52 GMT</pubDate>
    <dc:creator>MagD</dc:creator>
    <dc:date>2022-04-13T14:22:52Z</dc:date>
    <item>
      <title>Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807597#M33635</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me with this query. I want to convert this date 20DEC2019:12:49:00.000&amp;nbsp;to&amp;nbsp;20DEC2019.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807597#M33635</guid>
      <dc:creator>MagD</dc:creator>
      <dc:date>2022-04-13T14:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807600#M33636</link>
      <description>&lt;P&gt;Use the DATEPART() function and apply the DATE9. format&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807600#M33636</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-13T14:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807602#M33637</link>
      <description>&lt;P&gt;The first one looks like a DATETIME value, not a DATE value.&lt;/P&gt;
&lt;P&gt;SAS stores DATETIME values as number of seconds since 1960 and DATE values as number of days since 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert the number of seconds into number of days you can use the DATEPART() function.&amp;nbsp; You will then need to use a&amp;nbsp; date type format, like the DATE format that display in the style you showed, with the new value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just want to change how the value is displayed you can just change the FORMAT used to display the value without changing the value that is stored.&amp;nbsp; The DTDATE format will display datetime values in the style that the DATE format displays date values.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807602#M33637</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-13T14:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807603#M33638</link>
      <description>Hey Tom,&lt;BR /&gt;&lt;BR /&gt;I used this data step:&lt;BR /&gt;&lt;BR /&gt;data test;&lt;BR /&gt;set  hello;&lt;BR /&gt;AppDate1 = put(datepart(AppDate),date9.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;AppDate1 comes out as desired (20DEC2019) but it gets converted into a character varaible and I need it as a date.</description>
      <pubDate>Wed, 13 Apr 2022 14:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807603#M33638</guid>
      <dc:creator>MagD</dc:creator>
      <dc:date>2022-04-13T14:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807604#M33639</link>
      <description>Hey Paige&lt;BR /&gt;&lt;BR /&gt;I used this data step:&lt;BR /&gt;&lt;BR /&gt;data test;&lt;BR /&gt;set hello;&lt;BR /&gt;AppDate1 = put(datepart(AppDate),date9.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;AppDate1 comes out as desired (20DEC2019) but it gets converted into a character variable and I need it as a date.</description>
      <pubDate>Wed, 13 Apr 2022 14:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807604#M33639</guid>
      <dc:creator>MagD</dc:creator>
      <dc:date>2022-04-13T14:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807605#M33640</link>
      <description>&lt;P&gt;Why did you use PUT() to convert it to character if you didn't want a character variable?&lt;/P&gt;
&lt;P&gt;Might help to use more descriptive names for the variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set hello;
  AppDate1 = datepart(AppDate);
  format appdate1 date9.;
  rename appdate=AppDatetime appdate1=AppDate ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807605#M33640</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-13T14:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807606#M33641</link>
      <description>&lt;P&gt;The PUT function takes stuff (character or numeric), and converts it to character according to the used format.&lt;/P&gt;
&lt;P&gt;You do not want it here. Just use the DATEPART function and a FORMAT statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set hello;
AppDate1 = datepart(AppDate);
format Appdate1 date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807606#M33641</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-13T14:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807607#M33642</link>
      <description>Thanks Tom, it worked perfectly.&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-Dates/m-p/807607#M33642</guid>
      <dc:creator>MagD</dc:creator>
      <dc:date>2022-04-13T14:31:50Z</dc:date>
    </item>
  </channel>
</rss>

