Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: generating age variable

From   "Erik Ø. Sørensen" <>
Subject   Re: st: RE: generating age variable
Date   Fri, 22 Nov 2002 15:13:21 -0500

On fredag, nov 22, 2002, at 14:56 America/Montreal, Nick Cox wrote:

Kim Price [HTML deleted!!!]

I would like to create an age variable that subtracts
each dob from a particular date. I looked at the
reference guides and web page, but they were not
helpful in answering this question.
I've tried the following, but they both create missing values.

generate age=mdy(4,15,01-dob)/365.25
The "year" part of mdy has domain 100 to 9999, and should probably be something like 2001 - (year of birth). In both you examplese the year you provide is less than 100 and not valid (see documentation of mdy).


Erik Ø. Sørensen, <>.
phd student (economics), Norwegian School of Economics.
currently visiting Queen's University, Kingston, Ontario.

* For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index