<?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 Checking Dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182409#M46447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my Data set I have number of dates which are wrong. They appear as 01 - 31Dec9999 instead of 01 -31Dec1999.&lt;/P&gt;&lt;P&gt;What I want to do is to convert 9999 into 1999.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Nov 2014 17:12:05 GMT</pubDate>
    <dc:creator>Zatere</dc:creator>
    <dc:date>2014-11-22T17:12:05Z</dc:date>
    <item>
      <title>Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182409#M46447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my Data set I have number of dates which are wrong. They appear as 01 - 31Dec9999 instead of 01 -31Dec1999.&lt;/P&gt;&lt;P&gt;What I want to do is to convert 9999 into 1999.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 17:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182409#M46447</guid>
      <dc:creator>Zatere</dc:creator>
      <dc:date>2014-11-22T17:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182410#M46448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are these SAS dates or text fields?&lt;/P&gt;&lt;P&gt;If its a text field you can look into tranwrd searching for 9999 instead of 1999.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, are you sure these are incorrect. Its a common practice to code dates as 9999 to indicate a date in the distant future. The rationale for this is it makes it easier for querying date periods instead of needing to deal with null values. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 19:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182410#M46448</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-22T19:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182411#M46449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All dates are in a SAS Data Set. It seems that the values are incorrect, because they describe a period between 01JAN1998 and 31DEC2002.&lt;/P&gt;&lt;P&gt;When I checked the ranges for the dates (valid dates are only between 01JAN1998 and 31DEC2002)&amp;nbsp; I found those invalid values.&lt;/P&gt;&lt;P&gt;I have to either get rid of those invalid dates or to convert them into valid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Nov 2014 20:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182411#M46449</guid>
      <dc:creator>Zatere</dc:creator>
      <dc:date>2014-11-22T20:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182412#M46450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;9999 is usually used to indicate missing data. Is it possible to have missing values? Are all the values 31Dec9999 rather than various dates? If so then I'd definitely think the dates were invalid or something else rather than 31Dec1999. If the dates vary (i.e. 15Apr9999) then its possible. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nevertheless if you're 100% you can fix it two in a straightforward IF/THEN condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the data is a SAS date (numeric with date9. format in your case) then the following will work:&lt;/P&gt;&lt;P&gt;if year(old_date)=9999 then new_date=mdy(month(old_date), day(old_date), 1999);&lt;/P&gt;&lt;P&gt;else new_date=old_date;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 03:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182412#M46450</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-23T03:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182413#M46451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is must be a very large value in data variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
a='31Dec9999'd;
b=mdy(month(a),day(a),1999);
format a b date9.;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 08:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182413#M46451</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-23T08:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182414#M46452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both codes are working.&lt;/P&gt;&lt;P&gt;I did not want to create a new column therefore I used the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;if year(old_date)=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;&lt;STRONG&gt;9999&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; old_date=mdy(month(old_date), day(old_date), &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;&lt;STRONG&gt;1999&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;else old&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;_date=old_date;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;However I looked at the Data Set again and it seems that you are right because the dates do not vary; they are always 31Dec9999. The data set does not contain missing values, as per missing values check.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;If those dates are invalid rather than 31Dec1999 as I thought initially, may I ask how I should proceed with that? Should I delete them?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 14:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182414#M46452</guid>
      <dc:creator>Zatere</dc:creator>
      <dc:date>2014-11-23T14:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Checking Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182415#M46453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That depends on your subject area. Without any knowledge of the data its impossible to say. For example if this was a clinical trials process these may be people who survived past the trial date so then survival analysis method is used and those observations are censored.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Nov 2014 23:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-Dates/m-p/182415#M46453</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-23T23:56:11Z</dc:date>
    </item>
  </channel>
</rss>

