Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: re: counting patient-days--resolved


From   "Christopher W. Ryan" <[email protected]>
To   [email protected]
Subject   Re: st: re: counting patient-days--resolved
Date   Sun, 07 Aug 2005 17:36:38 -0400

Michael Blasnik's method was simple and worked great. Thank you for your help.
--
Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
and Wilson Family Practice Residency, Johnson City, NY
cryanatbinghamtondotedu
GnuPG and PGP public keys available at http://pgp.mit.edu

"If you want to build a ship, don't drum up the men to gather wood, divide the work and give orders. Instead, teach them to yearn for the vast and endless sea." [Antoine de St. Exupery]


Kit Baum wrote:

Michael said

I think there is a simpler solution than the ones proposed.

gen los=dischargedate-admitdate+1
gen date=admitdate
expand los
bysort patientid: replace date=date[_n-1]+1 if _n>1

you now have a dataset with one observation per patient per day where you
can count the number of days, etc..


That is indeed more elegant and Stataish. Like my proposal, it creates a long format dataset rather than hundreds of new variables.

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

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

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index