Hi, I have produced the table below and wanted to RAG rate the data against the first column e.g. if 17-19 is >Overall DNA then the section to be red, if 17-19 <Overall DNA then it would be green. Is this possible? Can someone please advise? Thanks /*Ageband Breakdown*/
proc sql;
create table DNA_Age as
select unique sesdate_d as Session_Date,
round (Count (perid),1) as Booked_Appointments,
round (Count (case when appstate='D' then perid end),1) as DNA_Appointments
round (Count (case when Age_Band='17-19' then perid end),1) as Booked_17_19,
round (Count (case when appstate= 'D' and Age_Band='17-19' then perid end),1) as DNA_17_19,
round (Count (case when Age_Band='20-29' then perid end),1) as Booked_20_29,
round (Count (case when appstate= 'D' and Age_Band='20-29' then perid end),1) as DNA_20_29,
round (Count (case when Age_Band='30-39' then perid end),1) as Booked_30_39,
round (Count (case when appstate= 'D' and Age_Band='30-39' then perid end),1) as DNA_30_39,
round (Count (case when Age_Band='40-49' then perid end),1) as Booked_40_49,
round (Count (case when appstate= 'D' and Age_Band='40-49' then perid end),1) as DNA_40_49,
round (Count (case when Age_Band='50-59' then perid end),1) as Booked_50_59,
round (Count (case when appstate= 'D' and Age_Band='50-59' then perid end),1) as DNA_50_59,
round (Count (case when Age_Band='60-69' then perid end),1) as Booked_60_69,
round (Count (case when appstate= 'D' and Age_Band='60-69' then perid end),1) as DNA_60_69,
round (Count (case when Age_Band='70+' then perid end),1) as Booked_70Plus,
round (Count (case when appstate= 'D' and Age_Band='70+' then perid end),1) as DNA_70Plus
from sessapp_final
group by Session_Date;
quit;
/*add percentage*/
data DNA_Age2 (drop=Percent Percent1 Percent2 Percent3 Percent4 Percent5 Percent6 Percent7);
set DNA_Age;
Percent=(DNA_appointments/Booked_appointments)*100;
Percent1=(DNA_17_19/Booked_17_19)*100;
Percent2=(DNA_20_29/Booked_20_29)*100;
Percent3=(DNA_30_39/Booked_30_39)*100;
Percent4=(DNA_40_49/Booked_40_49)*100;
Percent5=(DNA_50_59/Booked_50_59)*100;
Percent6=(DNA_60_69/Booked_60_69)*100;
Percent7=(DNA_70Plus/Booked_70Plus)*100;
Percent_DNA_Overall=round(percent, 01);
Percent_DNA_17_19=round(Percent1, .01);
Percent_DNA_20_29=round(Percent2, .01);
Percent_DNA_30_39=round(Percent3, .01);
Percent_DNA_40_49=round(Percent4, .01);
Percent_DNA_50_59=round(Percent5, .01);
Percent_DNA_60_69=round(Percent6, .01);
Percent_DNA_70Plus=round(Percent7, .01);
run;
/*reorder*/
proc sql;
create table Age_Final as
select Session_Date, Percent_DNA_Overall, Percent_DNA_17_19, Percent_DNA_20_29, Percent_DNA_30_39,
Percent_DNA_40_49, Percent_DNA_50_59, Percent_DNA_60_69,
Percent_DNA_70Plus
from DNA_Age2;
quit;
... View more