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: how to reshape data so that can perform calculations
From
"Kathleen Oberst" <[email protected]>
To
<[email protected]>
Subject
st: how to reshape data so that can perform calculations
Date
Tue, 22 Mar 2011 11:10:21 -0400
I have a dataset with person ID, discharge date, and another calculated
field in a long format as follows:
Id discharge date daysmissed y
x 1/1/2010 14 1
x 2/1/2010 9 2
y 1/5/2010 0 1
z 2/8/10 25 1
z 4/10/10 19 2
z 9/30/10 8 3
I'm trying to keep just those records of people who had >1 discharge and
then I want to calculate the elapsed time between dicharges. I generated
a marker 'y' to act as a counter for #admissions but can't really drop
anyone where y equals 1 because I will need that first d/c date for the
subsequent calculation. I've not had luck with reshape. I tried reshape
but it appears since the daysmissed and y variables can change
(appropriately so) between the records, it is not working (y not
constant error message). I'd welcome any suggestions. Thank you.
*
* 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/