Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: summarizing dates


From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: summarizing dates
Date   Fri, 17 Aug 2007 17:47:18 +0200

Jeph wrote:
 
I'm working with multiple observations per subject,
each with multiple date fields (eg, admission to hospital,
discharge from hospital, readmission, death). In trying
to work with them, I would like to be able to summarize
them. Eg,
 
 .sum admit_date if missing(disch_date)
 
But of course, this produces Stata elapsed date values,
which are only barely meaningful without formatting.
What I'd like to do is something like the above but get
mean, median etc displayed as formatted dates. Is there
a utility out there that can help? I know I can convert
them all to Julian dates, but those will be barely more
intelligible, and YYYYMMDD format will give distorted
summary values.
 
----------------------------------------------------
 
I assume that your dates are standard Stata dates. Try this:
 
   tabstat admit_date if missing(disch_date) , stat(mean median) format(%d)
 
Hope this helps
Svend
 
BTW. The Julian calendar was introduced by Julius Cesar in 46 BC. 
But since 1582 most of us use the Gregorian calendar.

________________________________________________________ 
 
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       sj@soci.au.dk 
_________________________________________________________ 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index