****************************************************************************************************
****************************************************************************************************
* PROGRAM: process_inputfiles.sas
* Created (mm/dd/yyyy): 11/30/2020
*--------------------------------------------------------------------------------------------------
* PURPOSE: The macro reads in the CREATEREPORTFILE and other input files and merges in relevant
* QRP input file parameter values
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro process_inputfiles();
%put =====> MACRO CALLED: process_inputfiles ;
/***************************************************************************************************
* Read in CREATEREPORTFILE and assign each parameter to a macro variable
***************************************************************************************************/
%isdata(dataset=input.&createreportfile.);
%if %eval(&nobs<1) %then %do;
%put ERROR: (Sentinel) CREATEREPORTFILE is missing.;
%put ERROR: (Sentinel) Make sure file is specified correctly and placed in the inputfiles folder;
/* Identify if leave behind report is being created based on the existance of the report_parameters dataset.
Create macro variable to identify if it is a leave behind report */
select count(*) into: numparms
from input.&createreportfile;
/*Assign all parameters to macro variables*/
%do createreportparameter = 1 %to %eval(&numparms.);
set input.&createreportfile;
if _n_ = &createreportparameter. then do;
call symputx("parameter", strip(parameter));
call symputx("value", strip(value));
if lowcase(parameter) in ('reporttype','stratifybydp','small_cellcounts','report_destination') then call symputx("value",upcase(value));
if lowcase(parameter) in ('redactcolumns') then call symputx("value",lowcase(value));
/*default report_destination is both*/
if lowcase(parameter) = 'report_destination' and missing(value) then call symputx("value","BOTH");
if lowcase(parameter) = 'stratifybydp' and missing(value) then call symputx("value","N");