<?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: Calculating Person-Years by Age in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/485202#M287086</link>
    <description>&lt;P&gt;Just wanted to point out that if there is&amp;nbsp;NO relationship between current_date and age then your dob_year calculation will be off by 1 for half of your data. As an example, run and examine the results of the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  informat dob current_date date9.;
  format dob current_date date9.;
  input age dob current_date;
  calc_age=floor(yrdif(dob,current_date));
  act_dob_year=year(current_date)-calc_age;
  dob_year=year(current_date)-age;  cards;
35 1jan1961 5oct1996
35 1feb1961 5oct1996
35 1mar1961 5oct1996
35 1apr1961 5oct1996
35 1may1961 5oct1996
35 1jun1961 5oct1996
35 1jul1961 5oct1996
35 1aug1961 5oct1996
35 1sep1961 5oct1996
35 1oct1961 5oct1996
35 1nov1961 5oct1996
35 1dec1961 5oct1996
35 1jan1962 5oct1996
35 1feb1962 5oct1996
35 1mar1962 5oct1996
35 1apr1962 5oct1996
35 1may1962 5oct1996
35 1jun1962 5oct1996
35 1jul1962 5oct1996
35 1aug1962 5oct1996
35 1sep1962 5oct1996
35 1oct1962 5oct1996
35 1nov1962 5oct1996
35 1dec1962 5oct1996
53 1jan1964 22mar2018
53 1feb1964 22mar2018
53 1mar1964 22mar2018
53 1apr1964 22mar2018
53 1may1964 22mar2018
53 1jun1964 22mar2018
53 1jul1964 22mar2018
53 1aug1964 22mar2018
53 1sep1964 22mar2018
53 1oct1964 22mar2018
53 1nov1964 22mar2018
53 1dec1964 22mar2018
53 1jan1965 22mar2018
53 1feb1965 22mar2018
53 1mar1965 22mar2018
53 1apr1965 22mar2018
53 1may1965 22mar2018
53 1jun1965 22mar2018
53 1jul1965 22mar2018
53 1aug1965 22mar2018
53 1sep1965 22mar2018
53 1oct1965 22mar2018
53 1nov1965 22mar2018
53 1dec1965 22mar2018
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Aug 2018 16:02:11 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-08-08T16:02:11Z</dc:date>
    <item>
      <title>Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484623#M287077</link>
      <description>&lt;P&gt;I have 2 variables as below. One is age and other is current date(reporting_date). I need to calculate year of birth from this 2 variables. How do i achieve this?&lt;/P&gt;&lt;P&gt;Age&amp;nbsp; &amp;nbsp; &amp;nbsp;current_date&lt;/P&gt;&lt;P&gt;53&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2018-03-22&lt;BR /&gt;53&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2018-03-22&lt;BR /&gt;51&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2018-02-16&lt;BR /&gt;54&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-02-06&lt;BR /&gt;55&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-04-12&lt;BR /&gt;60&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-03-13&lt;BR /&gt;62&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-03-15&lt;BR /&gt;71&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-02-27&lt;BR /&gt;71&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-04-09&lt;BR /&gt;56&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-06-21&lt;BR /&gt;56&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-03-12&lt;BR /&gt;67&amp;nbsp; &amp;nbsp; &amp;nbsp; 2018-01-25&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance,&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 06:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484623#M287077</guid>
      <dc:creator>sas_learnsups</dc:creator>
      <dc:date>2018-08-07T06:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484636#M287078</link>
      <description>&lt;P&gt;You cant. There is not enough information to calculate a date of birth.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 07:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484636#M287078</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-08-07T07:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484640#M287079</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;has said you can't, accurately.&amp;nbsp; You can however ascertain year:&lt;/P&gt;
&lt;PRE&gt;dob_year=year(current_date)-age;&lt;/PRE&gt;
&lt;P&gt;And you could also say it is a month of month(current_date) or less.&lt;/P&gt;
&lt;P&gt;That is as far as you could say.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 07:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484640#M287079</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-07T07:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484834#M287080</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;has said you can't, accurately.&amp;nbsp; You can however ascertain year:&lt;/P&gt;
&lt;PRE&gt;dob_year=year(current_date)-age;&lt;/PRE&gt;
&lt;P&gt;And you could also say it is a month of month(current_date) or less.&lt;/P&gt;
&lt;P&gt;That is as far as you could say.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And if your current_date is not an actual SAS date value with a SAS date format applied you need to convert that to a date value such as&lt;/P&gt;
&lt;PRE&gt;dob_year=year( input(current_date, yymmdd10.))-age;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Aug 2018 17:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484834#M287080</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-07T17:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484940#M287081</link>
      <description>&lt;P&gt;&lt;SPAN class="login-bold"&gt;Dear&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304" target="_self"&gt;draycut&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I know there is not enough information to calculate date of birth. I was looking if i could derive at least calculate "Year of Birth" which i did.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you very much.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 23:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484940#M287081</guid>
      <dc:creator>sas_learnsups</dc:creator>
      <dc:date>2018-08-07T23:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484942#M287082</link>
      <description>&lt;P&gt;Dear RW9,&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's exactly what I did. I agree with draycut, we cannot calculate date of birth, I actually was looking to derive "Year of Birth"&lt;/P&gt;&lt;P&gt;Thank you for suggesting that.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 23:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484942#M287082</guid>
      <dc:creator>sas_learnsups</dc:creator>
      <dc:date>2018-08-07T23:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484950#M287083</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194430"&gt;@sas_learnsups&lt;/a&gt;: You marked this as solved, but I question whether you actually have a solution. Unless I missed it, what does current_date represent?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 23:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484950#M287083</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-08-07T23:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484965#M287085</link>
      <description>&lt;P&gt;Hi Art297,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes i got the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have age and current_date (date of reporting an incident and the persons age on that particular day).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have uploaded screenshot for your reference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i get the year of birth by following statement:&lt;/P&gt;&lt;P&gt;dob_year=year(current_date)-age;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this answers your question!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_08_august_2018.PNG" style="width: 334px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22312i5DE7A1B0B4396701/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_08_august_2018.PNG" alt="Capture_08_august_2018.PNG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 02:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/484965#M287085</guid>
      <dc:creator>sas_learnsups</dc:creator>
      <dc:date>2018-08-08T02:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Person-Years by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/485202#M287086</link>
      <description>&lt;P&gt;Just wanted to point out that if there is&amp;nbsp;NO relationship between current_date and age then your dob_year calculation will be off by 1 for half of your data. As an example, run and examine the results of the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  informat dob current_date date9.;
  format dob current_date date9.;
  input age dob current_date;
  calc_age=floor(yrdif(dob,current_date));
  act_dob_year=year(current_date)-calc_age;
  dob_year=year(current_date)-age;  cards;
35 1jan1961 5oct1996
35 1feb1961 5oct1996
35 1mar1961 5oct1996
35 1apr1961 5oct1996
35 1may1961 5oct1996
35 1jun1961 5oct1996
35 1jul1961 5oct1996
35 1aug1961 5oct1996
35 1sep1961 5oct1996
35 1oct1961 5oct1996
35 1nov1961 5oct1996
35 1dec1961 5oct1996
35 1jan1962 5oct1996
35 1feb1962 5oct1996
35 1mar1962 5oct1996
35 1apr1962 5oct1996
35 1may1962 5oct1996
35 1jun1962 5oct1996
35 1jul1962 5oct1996
35 1aug1962 5oct1996
35 1sep1962 5oct1996
35 1oct1962 5oct1996
35 1nov1962 5oct1996
35 1dec1962 5oct1996
53 1jan1964 22mar2018
53 1feb1964 22mar2018
53 1mar1964 22mar2018
53 1apr1964 22mar2018
53 1may1964 22mar2018
53 1jun1964 22mar2018
53 1jul1964 22mar2018
53 1aug1964 22mar2018
53 1sep1964 22mar2018
53 1oct1964 22mar2018
53 1nov1964 22mar2018
53 1dec1964 22mar2018
53 1jan1965 22mar2018
53 1feb1965 22mar2018
53 1mar1965 22mar2018
53 1apr1965 22mar2018
53 1may1965 22mar2018
53 1jun1965 22mar2018
53 1jul1965 22mar2018
53 1aug1965 22mar2018
53 1sep1965 22mar2018
53 1oct1965 22mar2018
53 1nov1965 22mar2018
53 1dec1965 22mar2018
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 16:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Person-Years-by-Age/m-p/485202#M287086</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-08-08T16:02:11Z</dc:date>
    </item>
  </channel>
</rss>

