proc sql; create table rates as select distinct time, start, end, hsp_id, hsp_state_code, type, sum(case when input(hsp_id,7.)=&id. and input(nexthsp_id,7.)=&id. and readm30=1 then 1 else 0 end) as Numerator2 format=comma., sum(case when input(hsp_id,7.)=&id. then 1 else 0 end) as Denominator2 format=comma., calculated Numerator/calculated Denominator as pct format=percent8.3 from readmabase group by time,start,end,hsp_id,hsp_state_code,type order by hsp_state_code, hsp_id, time; quit;
... View more