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

Re: st: creating an array with hospitalization days


From   jean ries <[email protected]>
To   [email protected]
Subject   Re: st: creating an array with hospitalization days
Date   Tue, 08 Nov 2005 22:44:03 +0100

Maria,

I think that our problem is best solved if you are using "long" instead of "wide" data. But as Nick Cox has pointed out, you probably won't need all these extra variables.

. gen begin = admitday - mdy(10,1,2000) + 1
. gen end = disday - mdy(10,1,2000) + 1
. expand 365
. sort study_id
. by study_id: gen daynumber = _n
. by study_id: gen day = inrange(daynumber,begin,end)
. reshape wide day , i(study_id) j(daynumber)


best wishes,

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