Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • converting year of bith variable into age variable

    Hi,

    My dataset consist of a year of birth variable i.e 1960 and I would like to convert the year of birth variable into age. I have found helpful answers when the year of birth also includes month and dates, however, when you only have year of birth, how do one convert it to an age variable ?

    Helpful reply would be highly appreciated !

  • #2
    Well, without days and months you cant tell if a person has or has not celebrated birthday this year, so you can not tell the person age precisely. You can, however, get an approximation of it by making a simple subtraction.

    Code:
    gen estimated_age = 2019 - birth_year_variable
    In this scenario, if the person was born in 1960, the estimated age is 59 years, but this could be 58 if the person was born, say, in December 1960 (given we are in June 2019, this person has not fulfilled 59 years yet).

    Comment

    Working...
    X