<?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: Reg:Dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52518#M14453</link>
    <description>try this ..&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
    a='01jan1990'd;&lt;BR /&gt;
    b='31jul1992'd;&lt;BR /&gt;
    yeardiff =INTCK ( 'year', a, b ) ; &lt;BR /&gt;
    mondiff  =INTCK ( 'month', a, b ) ; &lt;BR /&gt;
    mondiff = mod(mondiff,12) ;&lt;BR /&gt;
    put yeardiff 'years ' mondiff  'months' ;    &lt;BR /&gt;
run;</description>
    <pubDate>Mon, 19 Jul 2010 11:00:06 GMT</pubDate>
    <dc:creator>DataShare</dc:creator>
    <dc:date>2010-07-19T11:00:06Z</dc:date>
    <item>
      <title>Reg:Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52517#M14452</link>
      <description>Hi&lt;BR /&gt;
i am having 2 dates i want it to be outputted in year and month for ex:&lt;BR /&gt;
&lt;BR /&gt;
a='01jan1990'd;&lt;BR /&gt;
b='31jul1992'd;&lt;BR /&gt;
c= 2 years 6 months&lt;BR /&gt;
i want the output like this 2 years 7 months in to new variable</description>
      <pubDate>Mon, 19 Jul 2010 09:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52517#M14452</guid>
      <dc:creator>sas_</dc:creator>
      <dc:date>2010-07-19T09:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52518#M14453</link>
      <description>try this ..&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
    a='01jan1990'd;&lt;BR /&gt;
    b='31jul1992'd;&lt;BR /&gt;
    yeardiff =INTCK ( 'year', a, b ) ; &lt;BR /&gt;
    mondiff  =INTCK ( 'month', a, b ) ; &lt;BR /&gt;
    mondiff = mod(mondiff,12) ;&lt;BR /&gt;
    put yeardiff 'years ' mondiff  'months' ;    &lt;BR /&gt;
run;</description>
      <pubDate>Mon, 19 Jul 2010 11:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52518#M14453</guid>
      <dc:creator>DataShare</dc:creator>
      <dc:date>2010-07-19T11:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reg:Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52519#M14454</link>
      <description>Just a variation:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
a='01jan1990'd;&lt;BR /&gt;
b='31jul1992'd;&lt;BR /&gt;
c=yrdif(a,b,'ACT/ACT');&lt;BR /&gt;
length d $ 22; &lt;BR /&gt;
d=cat(int(c),' year(s) ',ceil(12*mod(c,1)),' month(s)');&lt;BR /&gt;
put d=;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
You might want to replace the ceil() function with round() or floor().&lt;BR /&gt;
&lt;BR /&gt;
Your example does not really say what you intend to do with fractions of months, i.e. from 01Jan to 15Feb. Would this now be 1 month or 2 months.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick

Message was edited by: Patrick</description>
      <pubDate>Mon, 19 Jul 2010 13:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reg-Dates/m-p/52519#M14454</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-07-19T13:27:04Z</dc:date>
    </item>
  </channel>
</rss>

