I am trying to add boarders to the sub headers of the output of proc tabulate. I have created a custom style based off monochrome and I have some custom styling in the proc tabulate itself. The code I have:
data have;
length Name $10. Field1 $10. Field2 $10.;
infile datalines delimiter='#';
input Name $ Field1 $ Field2 $ N;
datalines;
Jim#stage1#Sub1#1
Steve#stage2#Sub2#1
Dave#stage2#Sub3#1
Jessica#stage2#Sub3#1
Bob#stage3#Sub3#1
Dan#stage2#Sub1#1
Jim#stage1#Sub1#1
Steve#stage1#Sub3#1
Dave#stage2#Sub2#1
Jessica#stage2#Sub2#1
Bob#stage2#Sub1#1
Dan#stage2#Sub3#1
;
run;
proc template;
define style my_monospace;
parent=styles.monospace;
class fonts /
'docFont' = ("Trebuchet MS",8pt)
'headingFont' = ("Trebuchet MS",9pt,Bold)
'headingEmphasisFont' = ("Trebuchet MS",9pt,Bold)
'FixedFont' = ("Trebuchet MS",8pt)
'FixedHeadingFont' = ("Trebuchet MS",8pt)
'FixedStrongFont' = ("Trebuchet MS",8pt)
'FixedEmphasisFont' = ("Trebuchet MS",8pt)
'EmphasisFont' = ("Trebuchet MS",8pt)
'StrongFont' = ("Trebuchet MS",8pt)
'TitleFont' = ("Trebuchet MS",10pt,Bold)
'TitleFont2' = ("Trebuchet MS",10pt,Bold)
'BatchFixedFont' = ("Trebuchet MS",8pt);
class Header /
backgroundcolor=cxEEEEEE;
end;
end;
run;
proc template;
source styles.monospace / expand;
run;
ods excel file="...somedirectory\test.xlsx";
title1 j=center "Title1" ;
title2 j=center "Title2" ;
title3 j=center "Title3" ;
ods excel options
(
sheet_name="Table"
sheet_interval="none"
frozen_headers="3"
embedded_titles="yes"
)
style=my_monospace;
;
PROC TABULATE
DATA=WORK.have
S=[foreground=black just=c cellwidth=125];
VAR N;
CLASS Field1 / ORDER=UNFORMATTED MISSING;
CLASS Field2 / ORDER=UNFORMATTED MISSING;
CLASS Name / ORDER=UNFORMATTED MISSING;
TABLE
/*Row Dimension*/
Name *'N'=' '
ALL*{style=[font_weight=bold just=center background = cxE5B82E ]}
,
/* Column Dimension */
Field1*Field2 =' '
ALL*{style=[font_weight=bold just=center background = cxE5B82E ]}
;
RUN;
The output it generates:
the output I'm trying to achieve:
I'm lost in the styles part - there's so many and I'm not sure what to change to get what I want. Any help with achieving the output I want and how to navigate and understand styles would be helpful.
... View more