<?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: Date formated as &amp;quot;Character&amp;quot; - can I translate it to for instance Date9 format? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747824#M234790</link>
    <description>&lt;P&gt;You will need to create a new variable&lt;/P&gt;
&lt;P&gt;Since there is no standard date that does year day month you will need to pull that value apart to get the month, day and year values and use the MDY function to create the date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do your values &lt;STRONG&gt;always&lt;/STRONG&gt; use two digits for the day of month and month of the year? If not you are going to have to provide a lot more examples and what dates they actually represent. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jun 2021 14:40:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-06-14T14:40:27Z</dc:date>
    <item>
      <title>Date formated as "Character" - can I translate it to for instance Date9 format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747819#M234786</link>
      <description>&lt;P&gt;In a table that I have loaded, the dates are written as &lt;STRONG&gt;character&amp;nbsp;&lt;/STRONG&gt;format.&amp;nbsp;For instance:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;201601 represents year 2020, date 16, month 1 [16 january 2020].&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there any way I could transform this to a date format so I could do ordinary date calculations?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 14:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747819#M234786</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-14T14:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Date formated as "Character" - can I translate it to for instance Date9 format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747824#M234790</link>
      <description>&lt;P&gt;You will need to create a new variable&lt;/P&gt;
&lt;P&gt;Since there is no standard date that does year day month you will need to pull that value apart to get the month, day and year values and use the MDY function to create the date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do your values &lt;STRONG&gt;always&lt;/STRONG&gt; use two digits for the day of month and month of the year? If not you are going to have to provide a lot more examples and what dates they actually represent. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 14:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747824#M234790</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-14T14:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: Date formated as "Character" - can I translate it to for instance Date9 format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747835#M234798</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In a table that I have loaded, the dates are written as &lt;STRONG&gt;character&amp;nbsp;&lt;/STRONG&gt;format.&amp;nbsp;For instance:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;201601 represents year 2020, date 16, month 1 [16 january 2020].&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there any way I could transform this to a date format so I could do ordinary date calculations?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So, first, let's clear up something, you don't need any particular format to do date calculations. You do need to have the date value represented as an integer (which is a numeric variable) whose value is the number of days since 01JAN1960.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ignoring (for a minute) the valid concern expressed by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;about your two-digit years, you can convert this to the a numeric date like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;numeric_date = mdy(input(substr(char_date,5,2),2.),
    input(substr(char_date,3,2),2.),
    input(substr(char_date,1,2),2.)+2000);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 16:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-formated-as-quot-Character-quot-can-I-translate-it-to-for/m-p/747835#M234798</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-14T16:46:00Z</dc:date>
    </item>
  </channel>
</rss>

