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: Date format
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Date format
Date
Sat, 29 Sep 2012 16:57:17 +0100
But you could use the -d()- function, which maps date strings to
numeric daily dates.
. di d(31mar2011)
18717
. di mdy(3, 31,2011)
18717
On Sat, Sep 29, 2012 at 4:50 PM, Nick Cox <[email protected]> wrote:
> If -date- is a daily date variable then
>
> list date if date == mdy(3,31,2011)
>
> will list all instances of that date in the variable -date- in your data.
>
> That won't be very interesting. You will probably find something like
>
> list if date == mdy(3,31,2011)
>
> more helpful. Note that
>
> 31mar2011
>
> as your wrote it can't mean anything in this context, as it can't be
> the name of a variable or scalar, and it can't be a literal string as
> it is not delimited by " ". (Nor would a literal string be any use
> here as dates in Stata are numeric.)
>
> Nick
>
> On Sat, Sep 29, 2012 at 4:37 PM, Sebastian Skalitzky
> <[email protected]> wrote:
>
>> I am having a problem with my date variable. I want to list all
>> observations which occurred at the same date.
>> Therefore I tried the following line:
>>
>> list date if==31mar2011
>>
>> however I receive the following message
>>
>> 31mar2011 invalid name
>> r(198);
>>
>> Some information on the variable date:
>> Type: long
>> Format: %d
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/