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   Phil Clayton <[email protected]>
To   [email protected]
Subject   Re: st: date("01jan1960", "DMY") does not seem to work with -if- qualifier of the command -tablist-
Date   Wed, 23 Mar 2011 00:16:14 +1100

There's a typo in B:

& date <= `date("03Jan2003" ...
should be
& date <= `=date("03Jan2003" ...

Phil

On 23/03/2011, at 12:09 AM, Amy Dunbar 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
> 
> Amy Dunbar
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Eric Booth
> Sent: Monday, March 21, 2011 9:07 PM
> To: <[email protected]>
> Subject: Re: st: date("01jan1960", "DMY") does not seem to work with -if- qualifier of the command -tablist-
> 
> <>
> 
> Try changing your last line to:  
> 
> tablist bday name if statadate > `=date("01Jan1960", "DMY")'
> 
> - Eric
> __
> Eric A. Booth
> Public Policy Research Institute
> Texas A&M University
> [email protected]
> 
> 
> On Mar 21, 2011, at 7:22 PM, Jeremy Page wrote:
> 
>> I am a frequent user of the user generated command -tablist- and I 
>> have run into a behavior that I can not explain.  I am trying to use 
>> Stata's -date- command with the -if- qualifier to restrict 
>> observations from displaying in -tablist-.  When I attempt to do this 
>> there appears to be a problem.  I am able to use the -date- command to 
>> restrict observations with -tabulate- and I am able to restrict 
>> observations in -tablist- with a local variable being defined by the
>> -date- command but not with -tablist-.  It is my understanding that 
>> the -if- qualifiers across all programs should act the same.  Am I 
>> missing something?  I have included an example below using a Stata 
>> supplied data set.
>> 
>> I am using version 1.2 of -tablist- which can be found at -findit
>> tablist- and my version of Stata is 10.1 on a Windows XP machine.
>> 
>> Thank you for your help.
>> 
>> Best,
>> Jeremy
>> 
>> 
>> 
>> **********begin example*************** clear use 
>> http://www.stata-press.com/data/r10/datexmpl.dta
>> 
>> 
>> gen statadate = date(bday, "DMY")
>> 
>> format statadate %td
>> 
>> list statadate
>> 
>> display date("01Jan1960", "DMY")
>> 
>> ***it works with tabulate
>> tab bday name if statadate > date("01Jan1960", "DMY")
>> 
>> 
>> ***it works with a local variable
>> local dte = date("01Jan1960", "DMY")
>> tablist bday name if statadate > `dte'
>> 
>> ***it does not work with tablist
>> tablist bday name if statadate > date("01Jan1960", "DMY")
>> 
>> 
>> ************end example***************
>> 
>> *
>> *   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/
> 
> *
> *   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