I have a SAS code that, from crosstab tables, generates mini datasets that are then run through Proc Report to generate individual report tables to show prevalence estimates & 95% CLs from survey items across 5 years.
There are about 55 individual variables, all with 2+ response categories.
Is it possible to get these all into one single table, so that each variable is still its own group, separated by a bold horizontal line?
** List of ~55 variables code iterates through;
%let crossnames= bpinsur dpinsur ppinsur . . . . . ;
ODS HTML;
%macro dothisb;
TITLE;
%do i=1 %to %sysfunc(countw(&crossnames));
%let thisname=%scan(&crossnames,&i,%str( ));
** Create Simplified crosstab datasets;
Data year3_&thisname;
Set year2_&thisname;
length newvar $20;
length CLS $12;
newvar=cat(put(Row_Percent, 4.1),' [',put(Lower_CL, 4.1),' ',put(Upper_CL, 4.1),']');
CLS=cat(' [',put(Lower_CL, 4.1),'-',put(Upper_CL, 4.1),']');
DROP RowPercent RowLowerCL RowUpperCL ;
Label newvar="%[95%CL]";
Label CLS="[95%CL]";
Run;
** PROC REPORT;
Proc report data=year3_&thisname out=report_&thisname
nowd CENTER WRAP
;
Column &thisname YY4_DOB,(Row_Percent CLS) dummyvar;
Define &thisname / order=internal group flow;
Define yy4_DOB / "Year" across;
Define Row_Percent / "%" display;
Define CLS / display ;
Define dummyvar / computed noprint ;
compute dummyvar;
dummyvar = 1;
endcomp;
Run;
%end;
ODS rtf CLOSE;
%mend;
%dothisb
Year
2016
2017
2018
2019
2020
Reported Insurance During
%
[95%CL]
%
[95%CL]
%
[95%CL]
%
[95%CL]
%
[95%CL]
None
3.2
[1.2 - 4.2]
Private
Medicaid
Year
2016
2017
2018
2019
2020
Reported Insurance After
%
[95%CL]
%
[95%CL]
%
[95%CL]
%
[95%CL]
%
[95%CL]
None
Private
Medicaid
... View more