07-01-2015 06:02 AM
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?
07-01-2015 09:11 AM
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;