****************************************************************************************************
****************************************************************************************************
* PROGRAM: figure_t5_createdata.sas
* Created (mm/dd/yyyy): 09/08/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: Create dataset formatted to produce Figures for Type 5 report.
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro figure_t5_createdata();
%put =====> MACRO CALLED: figure_t5_createdata;
/*--------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------*/
%isdata(dataset=agg_t5first);
%if %eval(&nobs.>0) %then %do;
/*--------------------------------------------------------------------------------------------*/
/* Determine all levelIDs, metrics and stratifications requested */
/*--------------------------------------------------------------------------------------------*/
select distinct quote(levelid1) into :levellist separated by ','
from figurefile(where=(figure in ('F1', 'F2', 'F3')));
select distinct figuresub into :figuresublist separated by ' '
from figurefile(where=(figure in ('F1', 'F2', 'F3')));
/*define stratification variables for class statement*/
%let stratvars = &figuresublist.;
%if %index(&stratvars., agegroup)>0 %then %let stratvars = &stratvars. agegroupnum;
%if %index(&stratvars., overall)>0 %then %let stratvars = %sysfunc(tranwrd(&stratvars.,overall, %str())) ;
/*F1 = npts*/ %let npts = ;
/*F2 = adjustedcodecount*/ %let adjustedcodecount = ;
/*F3 = daysupp*/ %let daysupp = ;
%if %sysfunc(prxmatch(m/F1/i,&figurelist.)) %then %let npts = npts;
%if %sysfunc(prxmatch(m/F2/i,&figurelist.)) %then %let adjustedcodecount = adjustedcodecount;
%if %sysfunc(prxmatch(m/F3/i,&figurelist.)) %then %let daysupp = daysupp;