title: How to calculate 'age last birthday' on a given date for a given birthday in SAS PROC SQL step
body: <p>I want to calculate '<a href="https://stats.oecd.org/glossary/detail.asp?ID=6621" rel="nofollow">age last birthday</a>' on a specific evaluation date, given a specific date of birth, using a SAS <code>PROC SQL</code> command.</p>
  
  <p>How can I do this and are there any limitations?</p>
  
  <p><strong>Sample Input</strong></p>
  
  <pre><code>DATA INPUTS;
  infile cards dlm=',' dsd;
  INPUT  DOBDt :DATE9. EvalDt :DATE9. expected;
  FORMAT DOBDt date9. EvalDt date9.;
  CARDS;
  11MAY2009,10MAY2015,5
  11MAY2009,11MAY2015,6
  11MAY2009,12MAY2015,6
  28FEB1984,01DEC2015,31
  29FEB1984,28FEB2012,27
  29FEB1984,29FEB2012,28
  29FEB1984,01MAR2012,28
  ;
  RUN;
  </code></pre>
  
  <p>The goal would be to take the <code>dobDt</code> as an input, evaluate on the <code>EvalDt</code> and produce the answer of <code>expected</code></p>