****************************************************************************************************
****************************************************************************************************
* PROGRAM: figure_l1_driver.sas
* Created (mm/dd/yyyy): 07/14/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro drives the creation of L1 figures
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro figure_l1_driver();
%put =====> MACRO CALLED: figure_l1_driver;
/**********************************************************************************************
1) F1: t1censor = Reasons for End of Observable Data by Group (1-CDF)
1) F1: t2followuptime = Kaplan-Meier Estimate of Event of Interest Not Occurring
2) F2: t2followuptime = Reasons for End of Follow-Up by Group (1-CDF)
3) F3: t2censor = Reasons for End of Observable Data by Group (1-CDF)
1) F1: Patient Entry into Study by Month
2) F2: Number of Prescription Dispensings in Patients First Episodes by Month
3) F3: Total Days Supply in Patients First Episodes by Month
4) F4: t5censor = Reasons for End of First Treatment Episode by Group
5) F5: t5censor = End of First Treatment Episode due to [Censoring Reason] by Group
1) F1 (not yet implemented)
2) F2 (not yet implemented)
3) F3 (not yet implemented)
4) F4: t6plota = Kaplan-Meier Estimate of First Switch Not Occurring
5) F5: t6plotb = Kaplan-Meier Estimate of Second Switch Not Occurring
6) F6: t6plota = Reasons for Censoring at First Switch Evaluation by Analysisgrp
7) F7: t6plotb = Reasons for Censoring at Second Switch Evaluation by Analysisgrp
8) F8: t6plota = Cumulative Incidence of First Switch
9) F9: t6plotb = Cumulative Incidence of Second Switch
/***********************************************************************************************/
%isdata(dataset=figurefile);
%if %eval(&nobs>0) %then %do;
create table _squaregroup as
0 as day /*type 6 - length = 4*/ %if &reporttype.=T6 %then %do; length=4 %end;
from groupsfile(where=(includeinfigure='Y'))
/*loop through each figure*/
%do f = 1 %to %sysfunc(countw(&figurelist.));
%let figure = %scan(&figurelist., &f.);
set figurefile(where=(figure="&figure"));
call symputx('levelid1', levelid1);
call symputx('censordisplay', censordisplay);
if dataset = 't1censor' then call symputx('dataset', 'agg_t1censor');
else if dataset = 't2censor' then call symputx('dataset', 'agg_t2censor');
else if dataset = 't2followuptime' then call symputx('dataset', 'agg_t2followuptime');
else if dataset = 't5censor' then call symputx('dataset', 'agg_t5censor');
else if dataset = 't6plota' then call symputx('dataset', 'agg_t6plota');
else if dataset = 't6plotb' then call symputx('dataset', 'agg_t6plotb');
/*Assign figure to produce*/
if (dataset='t2followuptime' and figure = 'F1') |
(dataset='t6plota' and figure = 'F4') |
(dataset='t6plotb' and figure = 'F5') then call symputx('curve', 'KM');
else if (dataset='t6plota' and figure = 'F8') |