<?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: dateofbirth format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658128#M197249</link>
    <description>&lt;P&gt;If you have dates with 2 digit years then you likely want to set the&lt;/P&gt;
&lt;P&gt;Options yearcuttoff=1926;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Before the initial data set is read.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The option controls what 2-digit years are treated as before/after 2000.&lt;/P&gt;
&lt;P&gt;With that option set any 2-digit year of 26 or greater will be treated as 1926, 1927 .... Anything under 26 will be treated as 2025, 2024, 2023. 00 would be 2000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the data set was already created and you know that any of the dates that ended up later than 2020 or similar you could do something like:&lt;/P&gt;
&lt;PRE&gt;data tail.want;
   set tail.have;
   date=datepart(dateofbirth);
   if year(date)&amp;gt; 2020 then date=intnx('year',date,-100,'S');
   format date mmddyy10.;
run;&lt;/PRE&gt;
&lt;P&gt;The INTNX function is the SAS function for incrementing (or decrementing) date values. You specify the interval, the base value, the number of intervals to apply and optionally an alignment value. The 'S' says the "same" date but different year in this case.&lt;/P&gt;
&lt;P&gt;Which likely works with date of birth because we shouldn't have too many people born in the future.&lt;/P&gt;
&lt;P&gt;Other dates such as "date complete grade school" might be much more problematic as that might contain an expected date which could be 10 or more years in the future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I mentioned before: Tell how ever is creating dates with 2 digit years to &lt;FONT size="5" color="#FF00FF"&gt;&lt;STRONG&gt;stop it&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 17:37:20 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-06-12T17:37:20Z</dc:date>
    <item>
      <title>dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658098#M197227</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;Hi, I want to change the dateofbirth format from&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;06NOV41:00:00:00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to&amp;nbsp; &amp;nbsp; &amp;nbsp;06/11/1941&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;19MAY36:00:00:00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 19/05/1936&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;13OCT35:00:00:00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;13/10/1935&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;10JAN29:00:00:00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;10/01/2029 &lt;FONT color="#0000FF"&gt;&lt;U&gt;( this should be 10/01/1929)&lt;/U&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3" color="#000000"&gt;the code is used is:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="batang,apple gothic" size="3" color="#FF0000"&gt;data tail.want;/*formatting the dateofbirth*/&lt;BR /&gt;set tail.have;&lt;BR /&gt;date=datepart(dateofbirth);&lt;BR /&gt;format date mmddyy10.;&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Can you help me with this? &lt;FONT size="3"&gt;(0/01/2029 &lt;FONT color="#0000FF"&gt;&lt;U&gt;( this should be 10/01/1929))&lt;/U&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT size="3"&gt;thank you in advance!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658098#M197227</guid>
      <dc:creator>perk</dc:creator>
      <dc:date>2020-06-12T15:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658102#M197230</link>
      <description>&lt;P&gt;Try setting the options before you execute the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options yearcutoff=1926;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658102#M197230</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-12T15:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658105#M197233</link>
      <description>&lt;P&gt;*Check the default yearcutoff option;&lt;BR /&gt;proc options option=yearcutoff;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;*Adjust the yearcutoff;&lt;BR /&gt;options yearcutoff=1929;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;input dateofbirth datetime26.;&lt;/P&gt;
&lt;P&gt;date=datepart(dateofbirth);&lt;BR /&gt;format date mmddyy10.;&lt;BR /&gt;put date=;&lt;BR /&gt;cards;&lt;BR /&gt;06NOV41:00:00:00&lt;BR /&gt;19MAY36:00:00:00&lt;BR /&gt;13OCT35:00:00:00&lt;BR /&gt;10JAN29:00:00:00&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;25 data _null_;&lt;BR /&gt;26 input dateofbirth datetime26.;&lt;BR /&gt;27 &lt;BR /&gt;28 date=datepart(dateofbirth);&lt;BR /&gt;29 format date mmddyy10.;&lt;BR /&gt;30 put date=;&lt;BR /&gt;31 cards;&lt;/P&gt;
&lt;P&gt;date=11/06/1941&lt;BR /&gt;date=05/19/1936&lt;BR /&gt;date=10/13/1935&lt;BR /&gt;date=01/10/1929&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658105#M197233</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2020-06-12T15:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658107#M197235</link>
      <description>&lt;P&gt;Welcome to the communities!&lt;/P&gt;
&lt;P&gt;This needs to be fixed when the data is imported to SAS in the first place.&lt;/P&gt;
&lt;P&gt;Please show us an example of your data source.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658107#M197235</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-12T15:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658109#M197237</link>
      <description>&lt;P&gt;I agree Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; Right on!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658109#M197237</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-06-12T15:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658113#M197241</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Welcome to the communities!&lt;/P&gt;
&lt;P&gt;This needs to be fixed when the data is imported to SAS in the first place.&lt;/P&gt;
&lt;P&gt;Please show us an example of your data source.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And send a Nasty Gram to whoever is creating dates with 2-digit years.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658113#M197241</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-12T15:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658122#M197245</link>
      <description>&lt;P&gt;People who supply 2-digit years have 2-digit IQ's.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 17:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658122#M197245</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-12T17:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: dateofbirth format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658128#M197249</link>
      <description>&lt;P&gt;If you have dates with 2 digit years then you likely want to set the&lt;/P&gt;
&lt;P&gt;Options yearcuttoff=1926;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Before the initial data set is read.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The option controls what 2-digit years are treated as before/after 2000.&lt;/P&gt;
&lt;P&gt;With that option set any 2-digit year of 26 or greater will be treated as 1926, 1927 .... Anything under 26 will be treated as 2025, 2024, 2023. 00 would be 2000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the data set was already created and you know that any of the dates that ended up later than 2020 or similar you could do something like:&lt;/P&gt;
&lt;PRE&gt;data tail.want;
   set tail.have;
   date=datepart(dateofbirth);
   if year(date)&amp;gt; 2020 then date=intnx('year',date,-100,'S');
   format date mmddyy10.;
run;&lt;/PRE&gt;
&lt;P&gt;The INTNX function is the SAS function for incrementing (or decrementing) date values. You specify the interval, the base value, the number of intervals to apply and optionally an alignment value. The 'S' says the "same" date but different year in this case.&lt;/P&gt;
&lt;P&gt;Which likely works with date of birth because we shouldn't have too many people born in the future.&lt;/P&gt;
&lt;P&gt;Other dates such as "date complete grade school" might be much more problematic as that might contain an expected date which could be 10 or more years in the future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I mentioned before: Tell how ever is creating dates with 2 digit years to &lt;FONT size="5" color="#FF00FF"&gt;&lt;STRONG&gt;stop it&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 17:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dateofbirth-format/m-p/658128#M197249</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-12T17:37:20Z</dc:date>
    </item>
  </channel>
</rss>

