- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So in my ODS RTF testing, it seems the first line worked with highlighting it entirely like you see in TEST TITLE 1. However, it didn't work for TEST TITLE 2. How do I fix that?
%let outsy=E:\Users\pahn\Desktop\qb;
data qbdats;
input QB $ completed passes;
datalines;
Brett 23 35
Tom 21 29
Peyton 34 41
Eli 32 37
Aaron 26 38
;
run;
/* at this point main this is basically adding the _type_
variable but would be appropriate if your data was
per game or similar
A GROUP variable creates a stacked barchart with
separate colors for each level. If you only have
on value for a group it stands out as desired.
*/
proc summary data=qbdats;
class QB;
var completed passes;
output out=qbsums sum=;
run;
data qb_pass_rate;
set qbsums;
completion_rate = completed/passes ;
if missing(QB) then QB='Total';
run;
data attrmap;
/* The ID required variable contains the name of the attribute map */
/* The VALUE required variable contains the value of the GROUP variable,
which in this case is BARTYPE */
/* The FILLCOLOR variable is used to change the color for the bars created by the VBAR
statement. */
input id $ value fillcolor $;
datalines;
_type_ 0 green
_type_ 1 blue
;
run;
%let defaulttablefont=font_face=Calibri fontsize=10pt;
ods noresults escapechar='^';
%let bc=cx7BA0CD;
%let bw=1;
%let breaklinesandwich=borderbottomcolor=&bc borderbottomwidth=&bw.pt bordertopcolor=&bc bordertopwidth=&bw.pt;
/*%let boxy=borderwidth=&bw.pt bordercolor=&bc;*/
%let titlestyle=borderwidth=&bw.pt bordercolor=&bc font_face=Calibri fontsize=12pt fontweight=bold background=cxD3DFEE;
ods path sasuser.templat(UPDATE)
mylib.templat (READ)
sashelp.tmplmst(READ);
proc template;
define style styles.test1;
parent=styles.printer;
style fonts /
'docFont'=("Calibri",10pt)
;
style Body from Document /
marginbottom = 0.5in
margintop = 1in
marginright = 1in
marginleft = 1in;
style Table from Output /
/* bordercollapse = separate*/
rules = ALL
cellpadding = 2pt
borderspacing = 0.25pt
borderwidth = 2pt
borderstyle = solid
font=fonts('docFont');
style header from table /
just=left
vjust=middle
fontweight=bold
background=white
borderbottomcolor=black
borderbottomwidth=2pt;
class graph /
just=left;
end;
run;
ods rtf file="&outsy\qb_stats.rtf" style=styles.test1 startpage=no;
options nocenter;
ods rtf text="^{newline}^{style[font_face=Calibri fontsize=11pt &breaklinesandwich]This report provides a
summary of data collected for the QB passes in football. The task was issued to Pete in XXX game(s).}^{newline}";
ods rtf text="^{newline}";
ods rtf text="^S={&titlestyle}TEST TITLE 1: QB STATS";
/*ods rtf columns=2;*/
PROC REPORT DATA = qb_pass_rate(where=(qb^='Total')) MISSING nowd
STYLE(REPORT)=[BACKGROUND=WHITE ASIS=ON just=l frame=box &defaulttablefont]
style(column)=[&defaulttablefont]
style(summary)=[fontweight=bold bordertopcolor=black bordertopwidth=2pt]
;
COLUMN QB Completed passes pctComp;
COMPUTE qb;
COUNT+1;
IF (MOD(COUNT,2)) THEN CALL DEFINE (_ROW_, 'STYLE', 'STYLE=[BACKGROUND=cxD3DFEE]');
IF _BREAK_="_RBREAK_" THEN qb = 'Total';
ENDCOMP;
DEFINE qb / "QB" ORDER=data center;
DEFINE Completed / "# caught" center format=comma.;
DEFINE passes / "# of passes" center format=comma.;
define pctComp / "Pass Completion Rate (%)" computed center format=percent8.2;
compute pctComp;
pctComp=completed.sum/passes.sum;
endcomp;
RBREAK AFTER / SUMMARIZE;
RUN;
ods graphics on / width=3.5in height=2.5in;
/*ods graphics / reset=index imagename='barchart1' imagefmt=jpg;*/
/*ods graphics / width=3.5in height=2.5in reset=index imagename='barchart1' imagefmt=jpg;*/
/*ods listing gpath="&outsy";*/
proc sgplot data= qb_pass_rate dattrmap=attrmap noautolegend;
title; footnote;
xaxis label = 'QB' labelattrs=(Family=Calibri Size=10 Weight=bold)
type=discrete discreteorder=data display=(noticks);
yaxis label='Pass Completion Rate (%)' labelattrs=(Family=Calibri Size=10 Weight=bold)
tickvalueformat=percent6. grid gridattrs=(color=gray pattern=shortdash thickness=1);
vbar qb / response= completion_rate group=_type_ attrid=_type_ datalabel datalabelattrs=(weight=bold);
format completion_rate percent8.2;
run;
ods rtf text="^S={&titlestyle}TEST TITLE 2: BLABLABLA";
ods rtf text="^{unicode '25cf'x} ^{style[font_face=Calibri fontsize=11pt]blablabla1}";
ods rtf text="^{unicode '25cf'x} ^{style[font_face=Calibri fontsize=11pt]blablabla2}";
ods rtf text="^{unicode '25cf'x} ^{style[font_face=Calibri fontsize=11pt]blablabla3}";
/*ods graphics off;*/
/*ods listing close;*/
/*ods rtf columns=1;*/
ods rtf close;
ods _all_ close;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use outputwidth=100% to make the highlighting extend across the entire line. So that line of code becomes this:
ods rtf text="^S={outputwidth=100% &titlestyle}TEST TITLE 2: BLABLABLA";
https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Text-table-width/td-p/129071 also shows the syntax if you want to add it to your style template.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use outputwidth=100% to make the highlighting extend across the entire line. So that line of code becomes this:
ods rtf text="^S={outputwidth=100% &titlestyle}TEST TITLE 2: BLABLABLA";
https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Text-table-width/td-p/129071 also shows the syntax if you want to add it to your style template.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much 🙂