<?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: How to convert partial character dates to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802847#M316098</link>
    <description>&lt;P&gt;&amp;nbsp;My bad I missed that logic. Thanks for the explanation.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2022 18:20:45 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2022-03-18T18:20:45Z</dc:date>
    <item>
      <title>How to convert partial character dates to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802843#M316095</link>
      <description>&lt;P&gt;1. I have the following partial character dates how to convert them into numeric date and&amp;nbsp; &amp;nbsp;also compare&amp;nbsp; it with other date&lt;/P&gt;
&lt;P&gt;Chardate&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wantdate&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;year&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;comparedate&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flag&lt;/P&gt;
&lt;P&gt;2019-09&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SEP2019&amp;nbsp; &amp;nbsp; &amp;nbsp; 2019&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-01-20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-01-20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;2021-08&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AUG2021&amp;nbsp; &amp;nbsp; 2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-01-20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2020-01-20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. One more request.&amp;nbsp; lhow to perform&amp;nbsp; if&amp;nbsp; chardate&amp;lt; comparedate&amp;nbsp; &amp;nbsp;or year &amp;lt; year( comparedate) incase of&amp;nbsp; month missing then flag=Y else N&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 18:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802843#M316095</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-03-18T18:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert partial character dates to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802845#M316096</link>
      <description>&lt;P&gt;To make a date out of a partial string, you must first decide which day and month you want to set as a default. So which day in which month do you want to set when only a year is given, and which day when only year and month are given?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 18:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802845#M316096</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-18T18:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert partial character dates to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802846#M316097</link>
      <description>&lt;P&gt;Perhaps you could tell us, just in words, if your 5th grade teacher gave you this problem long before you learned to program a computer, what are the methods you would use to figure out if chardate&amp;lt; comparedate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS does not allow partial dates. It must have a year, it must have a month, and it must have a day. So the best thing to do, in my opinion, is if there is no day of the month, assign it to the first day of the month. If there is no month, then assign it to the first day of the year. If you want to do this, you could use this line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;numdate = input(cats(chardate,'-01-01'),yymmdd10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to create a variable named numdate, which could then be compared to any other date according to my rules above.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 18:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802846#M316097</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-18T18:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert partial character dates to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802847#M316098</link>
      <description>&lt;P&gt;&amp;nbsp;My bad I missed that logic. Thanks for the explanation.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 18:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-partial-character-dates-to-numeric/m-p/802847#M316098</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-03-18T18:20:45Z</dc:date>
    </item>
  </channel>
</rss>

