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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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