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 on April 23, 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 with the time


From   Guido Lüchters <guidoluechters@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem with the time
Date   Wed, 13 Apr 2011 18:54:25 +0200

Dear Nick
yes this is completely clear
but sometimes i am thinking: what if there was one internal date
representation within stata

On the other hand: the stata form is most flexible in respect to
import date values
like study-time in any unit
so pros/cons
But this time i was just not prepared

many thanks
Guido











On Wed, Apr 13, 2011 at 5:18 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> Right and wrong.
>
> -year()- expects an argument in days. So you are quite right on that.
>
> But -- and this is fundamental -- in Stata a format is just how data
> are displayed. It is not what the data are, or how they are stored.
>
> A format is irrelevant to numeric operations, just relevant on display.
>
> This is a very common confusion, perhaps because the word "format"
> tends to be used in so many ways for different software and computing
> purposes.
>
> So, for example, here is a daily date with a format that shows only the year:
>
> . di %td_CY  mdy(4,13,2011)
>  2011
>
> That is not perverse; it is not only possible but sometimes the answer
> to a question.
>
> Numeric data are not defined by their format! This might seem
> pedantry, but it is common to see people imagining on this list that
> changing a format changes a numeric value, and that is not true.
>
> It is true that in something like string(1.234, format("%2.1f")) the
> format determines the result, but in the more common case of numeric
> data it is best to keep value and format separate in your mind.
>
> Nick
>
> On Wed, Apr 13, 2011 at 4:05 PM, Oliver Jones
> <ojones@wiwi.uni-bielefeld.de> wrote:
>> Hi,
>> maybe the function year just can handle the format %td correctly?
>>
>> dis year(0)
>>
>> gives the expected result of 1960 which is Statas base year.
>> And then
>>
>> dis year(366)
>>
>> gives the year 1961.
>>
>> But I can't help more...
>>
>> Best
>> Oliver
>>
>> Am 13.04.2011 16:45, schrieb Guido Lüchters:
>>>
>>> Hi Statalist
>>>
>>> anybody knows
>>>
>>> why
>>>
>>> gen x=year(ym(1951,1))
>>>
>>> gives
>>> 1959 ?
>>>
>
> *
> *   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