****************************************************************************************************
****************************************************************************************************
* PROGRAM: figure_survivalcurves_createdata.sas
* Created (mm/dd/yyyy): 07/14/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: This macro computes Kaplan-Meier (KM), Cumulative Distribution Function (CDF), and
* Cumulative Incidence Function (CIF) estimates
* - MSOC dataset containing 1 row per day and columns containing counts of episodes censored
* - dataset: aggregate dataset from %aggregate_report_tables
* - rename: syntax to rename variables on input dataset
* - curve: KM, CDF or CIF
* - whereclause: where statement to restrict &dataset
* - dayvar: variable name for censor day variable
* - includegroups: Groups to include in report
* - includevars: For KM and CDF curves, censor reasons to include in final dataset.
* For CIF curves, censor reason to use as competing risk
* - eventvar: For CIF curves, censor reason to use as event of interest
* - transposedata: Y/N/T whether all groups are in 1 plot (Y=Yes, N=No, T=only execute transpose)
* - discardnegativetimegroups: list of groups to remove negative ttswitch (Relevant for T6 only)
* - figure: standard figure # from FIGUREFILE
* - Curve = CDF will produce a 1-CDF plot
* - Requires group names to be unique across runIDs
* - Can specify transposedata = T if prior dataset exists with stacked data - used to produce
* 2nd plot with the same data
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro figure_survivalcurves_createdata(dataset=,
discardnegativetimegroups=,
%put =====> MACRO CALLED: figure_survivalcurves_createdata;
/*--------------------------------------------------------------------------------------------*/
/* Confirm input dataset exists */
/*--------------------------------------------------------------------------------------------*/
%isdata(dataset=&dataset.);
%if %eval(&nobs.<1) %then %do;