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: date in stata
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: date in stata
Date
Sun, 7 Aug 2011 08:16:52 +0100
There is no problem with dates before 1900 such as you have.
You don't say what code you used or what data type is used for your
variable holding date of birth.
If the variable is string then in Stata 10 up the function -date()-
converts to integer dates.
. di date("25/05/1898", "DMY")
-22500
. di %d date("25/05/1898", "DMY")
25may1898
You can -generate- numeric date variables and assign them whatever
date format you wish.
. set obs 1
obs was 0, now 1
. gen date = date("25/05/1898", "DMY")
. format date %td
. l
+-----------+
| date |
|-----------|
1. | 25may1898 |
+-----------+
Nick
On Sun, Aug 7, 2011 at 5:29 AM, Luis Fallas <[email protected]> wrote:
> I have a variable "date" where I have two values before to 1900, but the
> stata only allows dates greater than or equal to 1900.
>
> Example:
>
> id sex date of bird
> 1 1 18/01/2000
> 2 2 12/09/1998
> 3 1 01/01/1969
> 4 1 21/03/1950
> 5 2 25/05/1898
>
>
> Is there any way to change the settings for the Stata allows dates prior to
> 1900?
>
*
* 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/