Do length of stay

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

Posts: 4
Joined: Thu Jun 07, 2012 1:24 pm

Do length of stay

Postby Lizzie » Wed Oct 23, 2013 1:19 pm

I have claims data as attached. For each patient, I need to count the number of admissions, and for each admission, I need to get length of stay. With Paient_ID, fromdate and throughdate of claims available, how could I get the last column, AdmissionNo?

Notice that fromdate and throughdate can be on the same day or not. Different claims can occur on the same dates. If there are thousands-millions of claims, is there any way to count the number of admissions and length of stay per admission?
You do not have the required permissions to view the files attached to this post.
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Do length of stay

Postby GerineL » Thu Oct 24, 2013 9:11 am

So you want to create this variable "admission no" that is already in the file now?

I don't get how this variable is created, for instance why are the stays from 01/02/2012 to 01/05/2012 all "1", and from 01/25/2012 to 01/31/2012 all 2?

Please can you elaborate on what it is you need exactly?

That being said, maybe what you need is a lag function.

For isntance, you can use a lag function to indicate whether or not an entry is the last one.
Posts: 116
Joined: Sat Oct 06, 2012 6:21 am

Re: Do length of stay

Postby » Sun Oct 27, 2013 6:34 am

I guess if fromdate is equal to throughdate, you'd like to count that as 1 rather than 0 days, right? Pity you don't seem to have admission times, then you could get both days as well as hours/mintues/seconds...

Anyway, try the following on the data you attached.

Code: Select all

*Admission number.

sort cases by patient_id fromdate.
compute admission_no = 1.
if $casenum ne 1 and patient_id = lag(patient_id) admission_no = lag(admission_no) + 1.

*Lenght of stay.

compute length_of_stay = datediff(throughdate,fromdate,"days") + 1.

desc length_of_stay.
Kind regards,

Ruben Geert van den Berg

Who is online

Users browsing this forum: No registered users and 1 guest