****************************************************************************************************
****************************************************************************************************
* PROGRAM: figure_t5_output.sas
* Created (mm/dd/yyyy): 09/08/2021
*--------------------------------------------------------------------------------------------------
* PURPOSE: Produce type 5 figures F1-F3
* -figurenum: figure number for report
* -figureletter: figure letter for report
* -where: where clause to restrict figure123.sas7bdat
* -figuresub: row in figurefile to produce table
* -yaxislabel1: Label for primary Y axis
* -yaxislabel2: Label for secondary Y axis
* -yvar: variable to use in plot
*--------------------------------------------------------------------------------------------------
* Sentinel Coordinating Center
* info@sentinelsystem.org
***************************************************************************************************;
%macro figure_t5_output(figure=, figurenum=, figureletter=, title=, where=, figuresub=, yaxislabel1=, yaxislabel2=, yvar=);
%put =====> MACRO CALLED: figure_t5_output;
/*figuresub format to display formatted values in figure*/
%if &figuresub. ne overall %then %do;
%let t5figureformat = $&figuresub.fmt.;
%if &collapse_vars = race & &figuresub. = race %then %do;
set lookup.lookup_footnotes(where = (type = "t5tablefig"));
call symputx('num_fn', 1);
select description into: fn1 - :fn&num_fn.
%assign_superscripts(type=raceunknown, order = 2);
%let unicode_forplot = %scan(&unicode_list., 1);
"0" = "Unknown(*ESC*){unicode '&unicode_forplot'x}"
"1" = "American Indian or Alaska Native"
"3" = "Black or African American"
"4" = "Native Hawaiian or Other Pacific Islander"
%let t5figureformat = $racefmtsuper.;
/*Save dataset to REPORTDATA folder*/
%isdata(dataset=repdata.figure&figurenum.&figureletter.);
%if %eval(&nobs.<1) %then %do;
data repdata.figure&figurenum.&figureletter.;
set figure123(where=(&where.));
/*stratified plot - collapse strata to determine correct Y axis*/
%let axisdata = repdata.figure&figurenum.&figureletter.;
%if &figuresub. ne overall %then %do;