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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: problem in reading dates in stata


From   stef salvez <loggyedy@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: problem in reading dates in stata
Date   Sat, 2 Jun 2012 18:34:54 +0100

thanks NIck

On 6/2/12, Nick Cox <njcoxstata@gmail.com> wrote:
> -help dates- explains about -date()- for various cases. Try
>
> gen edate1 = cond(length(trim(v1)) == 8, date(v1, "DM20Y"), date(v1,
> "DMY"))
>
> For "STATA" read "Stata".
>
> Nick
>
> On Sat, Jun 2, 2012 at 5:02 PM, stef salvez <loggyedy@googlemail.com>
> wrote:
>> Hi all,
>>
>> I have the following date strings
>> v1
>> 04-10-2009
>>  01/11/09
>> 29/11/09
>> 27/12/09
>> 31/01/10
>>
>> I tried to format the cells in MS excel but couldn't.
>> So, STATA has problem reading them with the command
>>
>> gen edate1 = date(v1, "DMY")
>>
>> Any code that could fix that problem?
>
> *
> *   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