BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a dataset containing patient admissions 'numadmit' and their stay period within a facility ('startdate' and 'enddate'). Each patient has a unique 'ID' but may have many records, one for each admission. Each admission has a 'startdate' and 'enddate'. These dates may be the same for multiple admissions.

How do I sum up the number of admissions for a particular patient for a certain period?

For example, I patient 'A' has 3 different 'numadmit' each equal to 1 for that record. The time period 'startdate' to 'enddate' are the same for each of the 3 admissions but this patient also has other entries with different date. How can I sum the number of admissions (in this case the sum would equal 3) for that patient within this period and also sum the number of admissions (this sum would be in a different record for the patient) for the other time period?
2 REPLIES 2
DBailey
Lapis Lazuli | Level 10
to count admissions for patient x between '01jan2010'd and '31jan2010'd:

proc sql;
select count(*) as Admissions
from tabla
where patientid=xxx
and startdate le '31jan2010'd
and enddate ge '01jan2010'd;
quit;


counts any admission that starts or ends during Jan 2011 or encompasses the whole month. Message was edited by: DBailey
sivaji
Fluorite | Level 6
If it is detail level data then simply counting rows/summing of numadmit is not actual admissions.

SD

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 2 replies
  • 1051 views
  • 0 likes
  • 3 in conversation