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: best practice for dates and times


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: best practice for dates and times
Date   Sat, 19 Feb 2011 20:10:27 +0000

That's 5 date-time columns, not 4.

On Sat, Feb 19, 2011 at 8:08 PM, Nick Cox <[email protected]> wrote:
> The solution depends on the problem. Sometimes, it is easier to import
> numeric variables and then convert them to Stata dates. This can be
> very easy. See for example
>
> http://blog.stata.com/2011/01/05/using-dates-and-times-from-other-software/
>
> Sometimes it is easier to import string variables (which I take it is
> what you mean by "text format") and convert them.
>
> I don't think there is any general better or best solution
> independently of how the dates are presented to you and what you want
> to do with them.
>
> Most of the complexity is apparent rather than real. The main
> difficulty is wading through the documentation to find the function
> you need. Once you've found a solution, it is easy to repeat it.
>
> Recently I was working with a dataset in which there were four data
> columns, Julian date, year, month and day and hour. The people I was
> working with didn't care about Julian date, so the main business was
> to apply -mdy()- and then -format-. Hour was just 0 or 12, so the most
> practical way forward was just to add 0.5 when the measurements were
> taken at midday.
>
> Nick
>
> On Sat, Feb 19, 2011 at 7:50 PM, Liao, Junlin <[email protected]> wrote:
>> I find that transfer data with dates and times is rather complicated with Stata. Lately I found that importing dates and times in text format and then converting with Stata functions would be the simplest approach. I'd like to hear if others have better solutions.
>

*
*   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