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   Eric Booth <[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 01:07:18 +0000

<>

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index