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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Date format


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Date format
Date   Sat, 29 Sep 2012 16:50:38 +0100

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
<sebastian.skalitzky@googlemail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index