Announcement

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

  • how can I turn year of birth into age?

    Hello!
    I'm trying to recode a variable named V241 in the World Values Survey data set (which can be found here: http://www.worldvaluessurvey.org/WVS...ntationWV6.jsp), that takes the form of the year of birth, and I want to turn it into a numeric value of age. I'm relatively new to Stata so I searched around for a way to do it but haven't found any solution that would apply to my particular situation. I did learn that I should first use the following command to figure out what type of data format it is:
    Code:
     des V241
    However, I'm not sure what the result means, it says the storage type is "long" and the display format is "%5.0f"

    I know I could try to use the "recode" command but that would require that i recode every year (from 1912-1999) within the command and I'm hoping there might be an easier way to go about this?
    Thank you!

  • #2
    Code:
    gen agein2019 = 2019 - birthyear

    Comment


    • #3
      Thank you very much! that worked.

      Comment

      Working...
      X