<?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 How to identify invalid dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537972#M148053</link>
    <description>&lt;P&gt;while read the data if i have an invalid date (like 31st Feb). How to identify this?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Feb 2019 15:06:56 GMT</pubDate>
    <dc:creator>vThanu</dc:creator>
    <dc:date>2019-02-23T15:06:56Z</dc:date>
    <item>
      <title>How to identify invalid dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537972#M148053</link>
      <description>&lt;P&gt;while read the data if i have an invalid date (like 31st Feb). How to identify this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 15:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537972#M148053</guid>
      <dc:creator>vThanu</dc:creator>
      <dc:date>2019-02-23T15:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify invalid dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537978#M148055</link>
      <description>&lt;P&gt;SAS will flag invalid data (which can't be converted with the informat used) with a NOTE in the log, and set the automatic variable _ERROR_.&lt;/P&gt;
&lt;P&gt;The value will be set to missing.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 15:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537978#M148055</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-23T15:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify invalid dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537979#M148056</link>
      <description>&lt;P&gt;this paper has what I believe you are asking for.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings13/122-2013.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings13/122-2013.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 15:46:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537979#M148056</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-02-23T15:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify invalid dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537985#M148058</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247664"&gt;@vThanu&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a short example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input d date9.;
format d date9.;
cards;
31DEC2018
.
31FEB2019
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks to the date informat used, messages in the log notify you about the invalid date in the third raw data record, but not about the missing date in the second:&lt;/P&gt;
&lt;PRE&gt;NOTE: Invalid data for d in line 221 1-9.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
221        31FEB2019
d=. _ERROR_=1 _N_=3&lt;/PRE&gt;
&lt;P&gt;Both will normally appear as numeric missing values in dataset TEST (displayed as a period).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can modify this behavior in different ways. For example, you can&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Avoid the above log messages by using the "??" format modifier.&lt;/LI&gt;
&lt;LI&gt;Distinguish between ordinary missing values and missing values due to invalid data (by means of the &lt;A href="https://documentation.sas.com/?docsetId=lesysoptsref&amp;amp;docsetTarget=p0opsnn1axipfvn11p3c04eeaml1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p0r9qdpjqx69e5n1g63so6m594wl" target="_blank" rel="noopener"&gt;INVALIDDATA= system option&lt;/A&gt;).&lt;/LI&gt;
&lt;LI&gt;Keep a character version of the raw data values (in an additional variable) in order to check what kind of invalid values you got.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options invaliddata='X';

data test;
input c $9. @1 d ??date9.;
format d date9.;
cards;
31DEC2018
.
31FEB2019
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the invalid date is represented by the special missing value &lt;FONT face="courier new,courier"&gt;.X&lt;/FONT&gt;, the log is clean and character variable C is available for investigations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see section&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p0r9qdpjqx69e5n1g63so6m594wl" target="_blank" rel="noopener"&gt;How Invalid Data Is Handled&lt;/A&gt; of the INPUT statement documentation for more information.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Feb 2019 16:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-invalid-dates/m-p/537985#M148058</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-02-23T16:08:29Z</dc:date>
    </item>
  </channel>
</rss>

