LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 1998, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 2 Mar 1998 17:23:18 -0500
Reply-To:   HERMANS1 <hermans1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   HERMANS1 <hermans1@WESTAT.COM>
Subject:   Re: Count Patient Days
Comments:   To: Randal Hergesheimer <madoc@IBM.NET>

As you describe the task, the multiple rows per stay confound the calculation. SAS SQL handles that sort of problem naturally with the DISTINCT qualifier. A VIEW first limits the dates and PID to distinct (unique) classes. The actual calculations become straightforward after that. The GROUP BY clause sums the rows within PID's. See below.

proc sql; create view testvw as select distinct admitday,disday,PID from test ; select sum(disday-admitday) as daystay from testvw group by PID ; quit;

A data table with admission and discharge dates on different rows requires a more complex but interesting method. Sig

______________________________ Reply Separator _________________________________ Subject: Count Patient Days Author: Randal Hergesheimer <madoc@IBM.NET> at Internet-E-Mail Date: 3/2/98 2:03 PM

Hello!

I need to count patient days by each patient. Below are seven records showing a typical admission and discharge pattern within one year.

ADMITDAY DISDAY PID 08APR96 27APR96 01 08MAY96 10JUL96 01 08MAY96 10JUL96 01 08MAY96 10JUL96 01 08MAY96 10JUL96 01 08MAY96 10JUL96 01 12JUL96 15JUL96 01

This particular patient actually entered the hospital on three separate occasions, 8 April 1996, 8 May 1996, and 12 July 1996. Included on each record is more information telling what was done to them. I can handle those problems. What I have not yeat been able to do is to sum the days FOR EACH PATIENT that they were in the hospital. In the example above, the correct count would be 85 days (19+63+3). How do I program SAS to do this?

Randy


Back to: Top of message | Previous page | Main SAS-L page