<?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 to Date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828890#M327455</link>
    <description>&lt;P&gt;Not being pedantic, but this is a datetime, not a date and SAS treats them differently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A date is stored as the number of &lt;STRONG&gt;days&lt;/STRONG&gt; from January 1, 1960.&lt;/P&gt;
&lt;P&gt;A datetime is stored as the number of &lt;STRONG&gt;seconds&lt;/STRONG&gt; from January 1, 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want a date or datetime read in?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a great, but longer and in depth, reference for dates and times in SAS&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302621"&gt;@Eugenio211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can we translate a character into date format,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example of my data:&amp;nbsp;2022-01-01 04:12:30.9808034 -05:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2022 16:51:14 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-08-16T16:51:14Z</dc:date>
    <item>
      <title>Character to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828744#M327382</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can we translate a character into date format,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example of my data:&amp;nbsp;2022-01-01 04:12:30.9808034 -05:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 19:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828744#M327382</guid>
      <dc:creator>Eugenio211</dc:creator>
      <dc:date>2022-08-15T19:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Character to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828746#M327384</link>
      <description>&lt;P&gt;If you truly only need the date portion this is probably easiest:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x= "2022-01-01 04:12:30.9808034 -05:00";
   y= input(x,yymmdd10.);
   format y yymmdd10.;
run;&lt;/PRE&gt;
&lt;P&gt;If you need the time and time zone info you need to get used to dealing with SAS terminology of date, time and datetime as DATE values use different units, days, than time and datetime values which use seconds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 19:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828746#M327384</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-15T19:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Character to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828890#M327455</link>
      <description>&lt;P&gt;Not being pedantic, but this is a datetime, not a date and SAS treats them differently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A date is stored as the number of &lt;STRONG&gt;days&lt;/STRONG&gt; from January 1, 1960.&lt;/P&gt;
&lt;P&gt;A datetime is stored as the number of &lt;STRONG&gt;seconds&lt;/STRONG&gt; from January 1, 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want a date or datetime read in?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a great, but longer and in depth, reference for dates and times in SAS&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302621"&gt;@Eugenio211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can we translate a character into date format,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example of my data:&amp;nbsp;2022-01-01 04:12:30.9808034 -05:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 16:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-to-Date-format/m-p/828890#M327455</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-16T16:51:14Z</dc:date>
    </item>
  </channel>
</rss>

