Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: generating age using dates
From
martine etienne <[email protected]>
To
[email protected]
Subject
Re: st: generating age using dates
Date
Fri, 17 Dec 2010 09:16:42 -0800 (PST)
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.
martine
----- Original Message ----
From: Neil Shephard <[email protected]>
To: [email protected]
Sent: Fri, December 17, 2010 12:05:11 PM
Subject: Re: st: generating age using dates
On Fri, Dec 17, 2010 at 4:56 PM, martine etienne <[email protected]> wrote:
> Thanks Neil,
> "very similiar" looks like this:
>
> tab age
>
> age | Freq. Percent Cum.
> ------------+-----------------------------------
> 49.85495 | 1 0.35 0.35
> 49.86043 | 1 0.35 0.70
> 49.86864 | 1 0.35 1.05
> 49.87685 | 1 0.35 1.39
> 49.89053 | 2 0.70 2.09
> 49.90421 | 1 0.35 2.44
> 49.90695 | 1 0.35 2.79
> 49.91516 | 2 0.70 3.48
> 49.92337 | 2 0.70 4.18
> 49.92611 | 1 0.35 4.53
> 49.93705 | 2 0.70 5.23
> 49.93979 | 1 0.35 5.57
> 49.94253 | 1 0.35 5.92
> 49.94527 | 3 1.05 6.97
> 49.948 | 1 0.35 7.32
> 49.95348 | 1 0.35 7.67
>
That clarifies that there are people of similar age that is your
problem, from your original posting it wasn't clear (to me) whether
this was your problem or the variables 'age' and 'nage' were very
similar (which would have been unlikely based on the code posted).
> please see the output of
>
> des nage age
>
> storage display value
> variable name type format label variable label
>----------------------------------------------------------------------------------------------------------------------
>-
>
> nage float %9.0g
> age float %9.0g
>
> The survey was administered to a random selection of patients, and our patient
> population is between 20-60years old.
>
>
> any thoughts?
How is the data formatted before you converted to %td variables?
Could it be that some years are two-digits whilst others are four?
How much missing data is there in the original "Date of Birth" and
"Survey date" variables and how are missing dates handled?
Neil
--
"Our civilization would be pitifully immature without the intellectual
revolution led by Darwin" - Motoo Kimura, The Neutral Theory of
Molecular Evolution
Email - [email protected]
Website - http://kimura-no-ip.org/
Photos - http://www.flickr.com/photos/slackline/
*
* 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/