Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: best practice for dates and times

From   Nick Cox <>
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 <> 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
> 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 <> 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:

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