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]

st: RE: Re: question about working with dates and times


From   "Visintainer, Paul" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Re: question about working with dates and times
Date   Tue, 27 Jul 2010 13:21:27 -0400

Thanks, Joe.  The examples are really helpful.

-p

________________________________________________
Paul F. Visintainer, PhD
Professor of Medicine, Tufts University School of Medicine
Director of Epidemiology and Biostatistics
Baystate Medical Center
Division of Academic Affairs - 3rd Floor
280 Chestnut Street
Springfield, MA 01199
(T) 413.794.7686
(F) 413.794.7689

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Joseph Coveney
Sent: Tuesday, July 27, 2010 9:53 AM
To: [email protected]
Subject: st: Re: question about working with dates and times

Paul Visintainer wrote:

Thanks, Joe.  I think I get it.  Rather than just specifying the interval, one
specifies the desired interval from the zero-point.

--------------------------------------------------------------------------------

In your original post, you mentioned wanting 36 hours, 14 days, etc.  You can 
take advantage of the -tc()- pseudofunction by treating 
-tc("02jan1960 00:00:00")- as a constant, representing how many milliseconds 
there are in one day.  See below for the 36-h, 14-d examples.  

The limitation of this tactic is illustrated as -day2- in my first reply, 
namely, the increment for "3 months" depends upon which three months of the 
year you're trying to span.

Joseph Coveney

. generate double day0 = tc("06oct2007 00:00:00")

. 
. * 36 h
. generate double day1 = day0 + ///
>     36 / 24 * tc("02jan1960 00:00:00")

. 
. * 14 days
. generate double day2 = day0 + ///
>     14 * tc("02jan1960 00:00:00")

. 
. format day? %tc

. 
. list day?, noobs

  +--------------------------------------------------------------+
  |               day0                 day1                 day2 |
  |--------------------------------------------------------------|
  | 06oct2007 00:00:00   07oct2007 12:00:00   20oct2007 00:00:00 |
  +--------------------------------------------------------------+


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

----------------------------------------------------------------------
Please view our annual report at http://baystatehealth.org/annualreport
 

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. If you have received this communication in error, please reply to the sender immediately or by telephone at 413-794-0000 and destroy all copies of this communication and any attachments. For further information regarding Baystate Health's privacy policy, please visit our Internet site at http://baystatehealth.org.

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