Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: -personage-

From   Nick Cox <>
Subject   st: -personage-
Date   Mon, 29 Oct 2012 18:06:23 +0000

Thanks as usual to Kit Baum, a package -personage- has been added to SSC.

This arises from a thread  started by José Maria Pacheco de Souza in


For most kinds of dates and times, especially year, half-yearly,
quarterly and monthly,
a difference of dates is just that, a difference, and the Stata code
to get that can be summarized concisely


(that's a subtraction sign). For daily dates when you want the result
in years (or completed years), difference in dates / 365.25, or that
rounded down, is an often-met rule. It is, I imagine, widely
attractive as simple, producing consistent results if applied
consistently, and adequately precise for many purposes. The twist with
daily dates is naturally the occurrence of leap years, with two linked
consequences of years varying between 365 and 366 days and the small
issue of what to do about anniversaries of events  on 29 February.

-personage- does the calculation as exactly as possible. It is
designed in the first instance for calculations of people's ages from
data on their birth date and some "current"
daily date. A new variable is generated containing age in (completed)
years; and new variables may be generated containing (1) time since
last birthday in days and (2) length of the current year. Nothing
stops application to any problem requiring completed years, and
optionally extra days, as a representation of the difference between
two daily dates.

Thanks to José, who rekindled my interest in this problem and Phil
Clayton, whose test cases exposed a bug in an earlier version.

-personage- works in Stata 8.2 up except that as advertised in


any users of Stata 8 or 9 downloading it will need to rename the
.sthlp file to .hlp for it to be readable by their Stata.


*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index