<?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 Question about date quality validation in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-date-quality-validation/m-p/125912#M1613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a character column called BIRTH_DT, where all the values are stored as DDMMYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example values:&lt;/P&gt;&lt;P&gt;"240578"&lt;/P&gt;&lt;P&gt;"210388"&lt;/P&gt;&lt;P&gt;"321284"&lt;/P&gt;&lt;P&gt;"010295"&lt;/P&gt;&lt;P&gt;"300594"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to extract all the values that aren't stored in a correct date format/syntax. So for example, the value "321284" would be extracted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could just do a substring of the first two sets of numbers and check that the day is between 01-31, and the month between 01-12, but that would a cheap solution with plenty of room for error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although this kind of date quality validation must be an incredibly frequent thing to do, it's surprisingly hard to find any good advice about it on Google. Perhaps I'm not a particularly good Googler. Any advice would be appreciated, thanks. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Oct 2013 13:48:01 GMT</pubDate>
    <dc:creator>EinarRoed</dc:creator>
    <dc:date>2013-10-28T13:48:01Z</dc:date>
    <item>
      <title>Question about date quality validation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-date-quality-validation/m-p/125912#M1613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a character column called BIRTH_DT, where all the values are stored as DDMMYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example values:&lt;/P&gt;&lt;P&gt;"240578"&lt;/P&gt;&lt;P&gt;"210388"&lt;/P&gt;&lt;P&gt;"321284"&lt;/P&gt;&lt;P&gt;"010295"&lt;/P&gt;&lt;P&gt;"300594"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to extract all the values that aren't stored in a correct date format/syntax. So for example, the value "321284" would be extracted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could just do a substring of the first two sets of numbers and check that the day is between 01-31, and the month between 01-12, but that would a cheap solution with plenty of room for error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although this kind of date quality validation must be an incredibly frequent thing to do, it's surprisingly hard to find any good advice about it on Google. Perhaps I'm not a particularly good Googler. Any advice would be appreciated, thanks. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 13:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-date-quality-validation/m-p/125912#M1613</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2013-10-28T13:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Question about date quality validation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Question-about-date-quality-validation/m-p/125913#M1614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generally in SAS we recommend using SAS date variables instead of character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you do something like this in a datastep:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;testdate= input(birth_dt, ddmmyy.);&lt;/P&gt;&lt;P&gt;if testdate=. then put "BIRTH_DT of " birth_dt "not valid for " &amp;lt;record identfying variables&amp;gt;;&lt;/P&gt;&lt;P&gt;Any values that are not valid for your format will result in a missing value of Testdate and the IF statement will write to the log any associated information if you add other variables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 13:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Question-about-date-quality-validation/m-p/125913#M1614</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-10-28T13:58:12Z</dc:date>
    </item>
  </channel>
</rss>

