Counts of hospital admissions per day per hospital

Reply
Contributor
Posts: 62

Counts of hospital admissions per day per hospital

Hi,

I have a data set that each observation represents admission to hospital and i have variables: admission day (day,month,year) and hospital ID.

I need to count admissions per day per each hospital. I need as well to find a max umber of admission during month and year for each hospital.

How could i do it?

Super User
Posts: 5,255

Re: Counts of hospital admissions per day per hospital

You should be able to do this by using SQL and group by.

Data never sleeps
Contributor
Posts: 65

Re: Counts of hospital admissions per day per hospital

data want1;

set have;

day=day(admission_day);

mnt=month(admission_day);

yr=year(admission_day);

run;

proc sql;

create table want2 as

select * , count(hsptl_id) as day_cnt from want1

group by hsptl_id, yr,mnt,day;

create table Month_Max as

select hsptl_id,yr,mnt,max(day_cnt) as max_adm_mnt from want2

group by hsptl_id,yr,mnt;


create table Year_Max as

select Hsptl_id,yr, max(day_cnt) as max_adm_yr from want2

group by hsptl_id,yr;


quit;

Ask a Question
Discussion stats
  • 2 replies
  • 199 views
  • 0 likes
  • 3 in conversation