Bookmark and Share

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: problem in reading dates in stata


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: problem in reading dates in stata
Date   Sat, 2 Jun 2012 17:21:32 +0100

-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 <[email protected]> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index