This should get you started. I couldn't match some of your results given the formulas listed. Also, having column names with spaces is generally a bad idea. proc sql; create table work.summary as select specialty_pharmacy, product, 'Milestone Period'n, sum(metric='AR')/sum(Milestone_Type='Referral') as Approval_Rate format=percent7.2, sum(case when metric='AR' then 'Days Achieved'n else 0 end) / sum(metric='AR') as Days_To_Approval format=comma5.2, sum(metric='FR')/sum(Milestone_Type='Referral') as Fulfillment_Rate format=percent7.2, sum(metric='FR') as Days_To_Fullfilment, sum(case when metric='COMP' then days_of_therapy else 0 end) / sum(case when metric='COMP' then 'Days Achieved'n else 0 end) as Compliance format=comma5.2, count(*) as Records from work.input group by specialty_pharmacy, product, 'Milestone Period'n ; quit;
... View more