I need to combine reasons from my dataset to look like these for the ones in the table that have a reason/cause. I have completed the programming part to create the table, but I don't know how to append the reason/cause to the code.
proc sql; create table table as select distinct 1 as no, 'Enrolled' as descrip, put(count(case when enrolled=1 then 1 else . end),2.) as count from enrolled
union select distinct 2 as no, 'Treated' as descrip, put(count(case when treated=1 then 1 else . end),2.) as count from treated
union select distinct 3 as no, 'Off-study prior to receiving therapy' as descrip, put(count(case when offstudy_pre_trt=1 then 1 else . end),2.) as count from offstudy_pre_trt
union select distinct 4 as no, 'On-study, Active' as descrip, put(count(case when off_study=0 then 1 else . end),2.) as count from on_study union select distinct 5 as no, 'On-study, LTFU' as descrip, put(count(case when ltfu=1 then 1 else . end),2.) as count from ltfu
union select distinct 6 as no, 'Deaths on study and cause of death' as descrip, put(count(case when death_onstudy=1 then 1 else . end),2.) as count from on_study
union select distinct 7 as no, 'Off-study and reason' as descrip, put(count(case when off_study=1 then 1 else . end),2.) as count from on_study
order by no; quit;
For #6 and #7, please tell me how to append the associated reason.
Thanks,
This is how the table should look:
Category
Number of Subjects
Enrolled
abc
Treated
abc with 1 retreatment
Off-study prior to receiving therapy
a
On study, active
b
On study, LTFU
aaa
Deaths while on study and cause of death
xx due to Progressive Disease
cy due to Transplant Complications
Off-study and reason
ab due to death
6 due to did not receive CAR T cells
... View more