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   Amy Dunbar <[email protected]>
To   "[email protected]" <[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:59:51 +0000

Thank you, Nick and Phil!  I get it now.  This listserv is wonderful!


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Tuesday, March 22, 2011 9:22 AM
To: [email protected]
Subject: Re: st: date("01jan1960", "DMY") does not seem to work with -if- qualifier of the command -tablist-

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/

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