With style inheritance, you will get more borders than you want. I tried PROC REPORT, and the trick is getting only 14 to have a right border. You can see the two attempts I tried below, which still does not give you exactly what you describe. I think you can adapt this SAS Note which requires creating multiple formats:
https://support.sas.com/kb/39/652.html
ods listing close;
ods escapechar='^';
ods pdf file="c:\temp\foo.pdf" style=journal;
proc tabulate data=sashelp.class ;
class name sex;
class age / style=<parent>;
classlev sex/style={borderrightcolor=red borderrightwidth=2} ;
classlev age/ style=<parent>;
tables name="",sex=""*age=""*[style=<parent>];
where age IN (13,14) ;
keyword n / style=<parent>;
run ;
proc report data=sashelp.class missing;
column name sex,((age,n)) dummy ;
define name / ' ' group;
define sex / across ' ' style(header)=[borderrightcolor=red borderrightwidth=2];
define age / across ' ' style(header)=[borderrightcolor=red borderrightwidth=2];
define n / ' ';
define dummy / computed noprint;
where age IN (13,14) ;
compute dummy;
call define('_c3_','style','style=[borderrightcolor=red borderrightwidth=2]');
call define('_c5_','style','style=[borderrightcolor=red borderrightwidth=2]');
endcomp;
run;
data class;
set sashelp.class;
blankcol=1;
run;
proc report data=class missing;
column name sex,((age,n) blankcol);
define name / ' ' group;
define sex / across ' ' style(header)=[borderrightcolor=red borderrightwidth=2];
define age / across ' ' ;
define n / ' ';
define blankcol / ' ' style(column header)=[foreground=red background=red cellwidth=.1in];
where age IN (13,14) ;
run;
ods pdf close ;
ods listing;
... View more