Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: generating age using dates


From   martine etienne <martieluvsu@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: generating age using dates
Date   Fri, 17 Dec 2010 09:32:52 -0800 (PST)

i used the following command:

encode q1_dob, generate (q1_dob2)


----- Original Message ----
From: Nick Cox <n.j.cox@durham.ac.uk>
To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Sent: Fri, December 17, 2010 12:19:42 PM
Subject: RE: st: generating age using dates

How did you "encode" that? 

Nick 
n.j.cox@durham.ac.uk 

martine etienne

the variable q1_dob2 is the only one that I generated from encoding the original 

variable q1_dob which was is in string format:


des q1_dob

              storage  display     value
variable name   type   format      label      variable label
----------------------------------------------------------------------------------------------------------------------


q1_dob          str10  %10s        

all years are four digits, see below:

tab q1_dob

     q1_dob |      Freq.     Percent        Cum.
------------+-----------------------------------
01/04/1956 |          1        0.35        0.35
01/05/1964 |          1        0.35        0.70
01/05/1968 |          1        0.35        1.05
01/06/1956 |          1        0.35        1.39
01/06/1963 |          1        0.35        1.74
01/07/1960 |          1        0.35        2.09
01/10/1975 |          1        0.35        2.44
01/12/1957 |          1        0.35        2.79
      
also, there is only one missing date of birth in the original variable and it is 

coded as 99/99/9999, there
are no missing dates in the survey_date variable.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



      
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index