🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 08-23-2017 07:07 PM
(6617 views)
At least through ODS PDF TEXT, how would I for example increase padding for TEST TITLE 1 and TEST TITLE 2 like you see in the PDF or through the output if you run the code below? As you can see, it looks pretty tightened up. I tried cellpadding= in ^S={} but that didn't seem to work unless it was for a PROC REPORT/TABULATE table. Any other ideas?
%let outsy=E:\Users\Pete\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='^';
/* Centralized border styles -Peter Ahn, 7/28/2017 */
%let bc=cx7BA0CD;
%let bw=0.5;
%let pdftextframe=borderleftcolor=&bc borderleftwidth=&bw.pt borderrightcolor=&bc borderrightwidth=&bw.pt
bordertopcolor=&bc bordertopwidth=&bw.pt borderbottomcolor=&bc borderbottomwidth=&bw.pt;
/*%let titlestyle=bordercolor=&bc borderwidth=&bw.pt font_face=Calibri fontsize=12pt fontweight=bold background=cxD3DFEE;*/
%let titlestyle=&pdftextframe 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 /
'TitleFont' = ("Arial",16pt)
'TitleFont2' = ("Arial",16pt)
'StrongFont' = ("<MTserif>, Times Roman",10pt,bold)
'EmphasisFont' = ("Calibri",10pt,bold)
'FixedEmphasisFont' = ("<MTmonospace>, Courier",9pt,italic)
'FixedStrongFont' = ("<MTmonospace>, Courier",9pt,bold)
'BatchFixedFont' = ("SAS Monospace, <MTmonospace>, Courier",6.7pt)
'FixedFont' = ("<MTmonospace>, Courier",9pt)
'headingFont' = ("<MTserif>, Times Roman",11pt,bold)
'docFont'=("Calibri",10pt)
;
style GraphFonts /
'NodeDetailFont' = ("Calibri",10pt)
'NodeInputLabelFont' = ("Calibri",10pt)
'NodeLabelFont' = ("Calibri",10pt)
'NodeTitleFont' = ("Calibri",10pt)
'GraphDataFont' = ("Calibri",8pt,bold)
'GraphUnicodeFont' = ("Calibri",10pt)
'GraphValueFont' = ("Calibri",10pt)
'GraphLabel2Font' = ("Calibri",10pt)
'GraphLabelFont' = ("Calibri",12pt,bold)
'GraphFootnoteFont' = ("Calibri",10pt)
'GraphTitleFont' = ("Calibri",10pt,bold)
'GraphTitle1Font' = ("Calibri",10pt,bold)
'GraphAnnoFont' = ("Calibri",10pt)
;
/* class TitlesAndFooters /*/
/* font = Fonts('TitleFont2')*/
/* backgroundcolor = colors('systitlebg')*/
/* color = colors('systitlefg')*/
/* ;*/
style systemtitle from TitlesAndFooters /
just=left
vjust=bottom
;
style Body from Document /
marginbottom = 0.5in
margintop = 0.6in
marginright = 0.6in
marginleft = 0.6in;
style Table from Output /
bordercollapse = collapse
rules = ALL
cellpadding = 2.5pt
cellspacing=0
borderspacing=1pt
bordercolor=cx7BA0CD
borderwidth=1pt
borderstyle = solid
;
style header from table /
just=left
vjust=middle
fontweight=bold
background=white
borderbottomcolor=cx7BA0CD
borderbottomwidth=1pt
paddingleft=4pt
paddingright=4pt
paddingtop=2pt
paddingbottom=2pt
;
class cell /
paddingleft=4pt
paddingright=4pt
;
class graph /
just=left;
end;
run;
ods pdf file="&outsy\qb_stats.pdf" style=styles.test1 startpage=no;
options nocenter nonumber nodate;
title "HEADER TEST";
ods pdf text="^S={font_face=Calibri fontsize=11pt borderbottomcolor=cx7BA0CD borderbottomwidth=1pt bordertopcolor=cx7BA0CD bordertopwidth=1pt}
^{newline}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 2}";
ods pdf text="^{newline}";
ods pdf text="^S={outputwidth=100% &titlestyle}TEST TITLE 1: QB STATS";
ods layout gridded columns=2;
ods region;
ods graphics on / width=3.5in height=2.5in;
PROC REPORT DATA = qb_pass_rate(where=(qb^='Total')) MISSING nowd
STYLE(REPORT)=[BACKGROUND=WHITE ASIS=ON just=l frame=box]
/* style(column)=[&defaulttablefont]*/
style(summary)=[bordertopcolor=cx7BA0CD 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;
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 region;
ods graphics on / width=3.5in height=2.5in;
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=solid thickness=1);
vbar qb / response= completion_rate group=_type_ attrid=_type_ datalabel;* datalabelattrs=(weight=bold);
format completion_rate percent8.2;
run;
ods layout end;
ods pdf text="^{newline 5}";
ods pdf text="^S={outputwidth=100% &titlestyle}TEST TITLE 2: BLABLABLA";
ods pdf text="^{unicode '25cf'x} ^{style[font_face=Calibri fontsize=11pt]blablabla1}";
ods pdf text="^{unicode '25cf'x} ^{style[font_face=Calibri fontsize=11pt]blablabla2}";
ods pdf text="^{unicode '25cf'x} ^{style[font_face=Calibri fontsize=11pt]blablabla3}";
ods pdf close;
ods _all_ close;
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use margintop= and marginbottom= to add space above and below the text.
ods pdf text="^S={outputwidth=100% &titlestyle margintop=5pt marginbottom=6pt}TEST TITLE 1: QB STATS";
ods pdf text="^S={outputwidth=100% &titlestyle margintop=11pt marginbottom=11pt}TEST TITLE 2: BLABLABLA";
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use margintop= and marginbottom= to add space above and below the text.
ods pdf text="^S={outputwidth=100% &titlestyle margintop=5pt marginbottom=6pt}TEST TITLE 1: QB STATS";
ods pdf text="^S={outputwidth=100% &titlestyle margintop=11pt marginbottom=11pt}TEST TITLE 2: BLABLABLA";