|
I recently started working with the Healthcare cost and utilization project Nationwide readmissions database. This database looks at hospital readmissions for patients hospitalized to all US hospitals.
The data is structured as illustrated above. The "Key" variable is a unique record for each hospitalization. The same patient hospitalized twice will have two different values of "key". The NRD visit link is a variable that identifies a unique patient across hospitalization, in the data above key 1 2 3 4 refer to a single patient admitted 4 times.
the "time to event" variable is the number of days between different hospitalizations. To protect patient privacy, true dates are not provided. the time to event is consistent across one patient but not different patients.
For example, in the data above, we can say that patient identified by NRD visit link value of 1 was hospitalized at 0, 10, 20 and 30 days but the absolute value of "time to event" has no meaning.
Similarly we can tell that patient NRD visit link 2 was admitted at 0, 10 and 20 days but the absolute numbers of "time to event" do not matter.
My question is, how can I generate a new variable that contains the difference between the first hospitalization and last for each patient? I want to create a fourth column in the above data that contain the difference between values of "time to event" and the smallest value of "time to event" for each patient as identified by "NRD visit link".
Thank you so much!
Comment