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: date("01jan1960", "DMY") does not seem to work with -if- qualifier of the command -tablist-


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: date("01jan1960", "DMY") does not seem to work with -if- qualifier of the command -tablist-
Date   Tue, 22 Mar 2011 13:21:53 +0000

In your B the second condition

date <= `date("03Jan2003", "DMY")'

should be

date <= `= date("03Jan2003", "DMY")'

The key difference here is that

`= exp'

forces evaluation of exp before the command in question fires up.

Nick

On Tue, Mar 22, 2011 at 1:09 PM, Amy Dunbar
<[email protected]> wrote:
> Why will A work, but not B?
>
> A.  replace event1=1 if date == `=date("02Jan2003", "DMY")'
> B.  replace event1=1 if date >= `=date("31Dec2002", "DMY")' & date <= `date("03Jan2003", "DMY")'
> *replace event1=1 if date >= 15705 & date <=15708  // this runs
>

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