I saw your question on the TABLEN page, but unfortunately I don't have a straightforward way to do this with that macro.
Here's how I would make it using PROC REPORT. I don't know of any special styles that would make it exactly how you want without a bit of programming like this:
proc sql;
%macro loop(varlist,labels);
create table readm as
%do i = 1 %to %sysfunc(countw(&varlist,%str( )));
%if &i>1 %then %do; OUTER UNION CORR %end;
select "%qscan(%superq(labels),&i,|)" as label,
sum(ifn(readmission=1,%scan(&varlist,&i,%str( )),0)) as n1,100*calculated n1/sum(%scan(&varlist,&i,%str( ))) as pct1,
strip(put(calculated n1,12.0))||' ('||strip(put(calculated pct1,12.1))||'%)' as n_pct1,
sum(ifn(readmission=2,%scan(&varlist,&i,%str( )),0)) as n2,100*calculated n2/sum(%scan(&varlist,&i,%str( ))) as pct2,
strip(put(calculated n2,12.0))||' ('||strip(put(calculated pct2,12.1))||'%)' as n_pct2,
sum(%scan(&varlist,&i,%str( ))) as total
from readmissions
%end;;
select * from readm;
%mend;
%loop(ed_visits op_visits lengthofstay,ED Visits|OP Visits|Length of Stay);
quit;
proc report data=readm nowd split='~'
style(column)={color=black
backgroundcolor = white
bordercolor = white
borderstyle = none}
style(lines)={color=black
backgroundcolor = white
bordercolor = white
borderstyle = none}
style(header)={background=white
color=black
bordercolor = white
borderstyle = none}
style(report)={color=black
cellpadding = 0
borderspacing = 0
cellspacing=0
frame = void
rules = groups
bordercollapse = separate
borderleftstyle = none
borderrightstyle = none
bordertopstyle = none
borderbottomstyle = none };
columns (label ('Readmission' n_pct1 n_pct2) total);
define label / display 'A0'x left style={fontweight=bold};
define n_pct1 / display 'Yes~N (%)' center style={cellwidth=1in}; define n_pct2 / display 'No~N (%)' center style={cellwidth=1in}; define total / display 'Total~N' center style={cellwidth=1in};
compute total;
shade+1;
if shade=1 then call define(_row_,'style/merge','style={bordertopstyle=solid bordertopcolor=black bordertopwidth=1');
if mod(shade,2)=0 then call define(_Row_,'style/merge','style={background=greyef}');
endcomp;
compute after/ style={bordertopstyle=solid bordertopwidth=1 bordertopcolor=black};
line @1 ' ';
endcomp;
compute before _page_/ style={borderbottomstyle=solid borderbottomwidth=1 borderbottomcolor=black};
line @1 ' ';
endcomp;
run;
A caveat is that it might look different in different ODS destinations since they all have their own style quirks.
... View more