I created a custom PROC TEMPLATE with all my desired fonts for generic table outputs by modifying an existing PDF style sasdocPrinter. I then stored this template into my working library, process1.
proc template;
define style MyStyle /store=process1.tmplts;
Replace Table from Output / frame=BOX Rules=groups cellpadding=2pt
borderspacing=0.75pt borderwidth=0.75pt borderstyle=solid;
Replace Body from Document / topmargin=1in bottommargin=1in
leftmargin=1in rightmargin=1in;
parent=styles.sasdocPrinter;
replace fonts / 'TitleFont2'=("Times New Roman", 10.1pt)
'TitleFont'=("Times New Roman", 10.1pt) 'StrongFont'=("Times New Roman",
10.1pt) 'EmphasisFont'=("Times New Roman", 10.1pt)
'FixedEmphasisFont'=("Courier New", 10.1pt)
'FixedStrongFont'=("Courier New", 10.1pt) 'FixedHeadingFont'=("Courier New",
10.1pt) 'BatchFixedFont'=("Courier New", 10.1pt) 'FixedFont'=("Courier New",
10.1pt) 'headingEmphasisFont'=("Times New Roman", 10.1pt)
'headingFont'=("Times New Roman", 10.1pt) 'docFont'=("Times New Roman",
10.1pt);
end;
run;
I'm in the same library, process1, to create my tables/figures/listings because I find staying in the same library easier for my work.
When I point to my custom template in the ODS PDF statement, nothing happens to my fonts, which means SAS isn't reading my template at all:
ods pdf style=tmplts.MyStyle;
proc report data=counts3 nowindows split="*" style(report)={rules=NONE frame=void}
headline headskip;
columns (invnid coli2 coli1 coli3);
define invnid /order style={cellwidth=31% asis=on just=l}
"Investigator Name, and Investigator Number";
define coli2 /display style={cellwidth=22% just=c} spacing=3 order order=data flow "Placebo*(n=&n2)" left;
define coli1 /display style={cellwidth=22% just=c} spacing=3 order order=data flow "CMP-135 * (n=&n1)" left;
define coli3 /display style={cellwidth=22% just=c} spacing=3 order order=data flow "All Patients * (n=&n3)" left;
break after invnid/skip;
compute after _page_/style={just=l font_face='Courier New' font_size=10pt bordertopcolor=black bordertopwidth=0.25};
line "Note:";
line "Investigator name & ID number used.";
endcomp;
title1 j=l 'Company/PRJ5457C';
title2 j=c 'Table 14.1/1';
title3 j=c 'Enrollment by Investigator';
title4 j=c 'Randomized Patients';
run;
How do I make sure that my template's parameters are invoked? THANK YOU!
Use an ODS PATH statement when creating custom templates.
libname process1 '/folders/myfolders/templates';
ods path template.process1(update) sashelp.tmplmst(read);
proc template;
define style MyStyle /store=process1.tmplts;
Replace Table from Output /
frame=BOX
Rules=groups
cellpadding=2pt
borderspacing=0.75pt
borderwidth=0.75pt
borderstyle=solid;
Replace Body from Document /
topmargin=1in
bottommargin=1in
leftmargin=1in
rightmargin=1in;
parent=styles.sasdocPrinter;
replace fonts /
'TitleFont2'=("Times New Roman", 10.1pt)
'TitleFont'=("Times New Roman", 10.1pt)
'StrongFont'=("Times New Roman", 10.1pt)
'EmphasisFont'=("Times New Roman", 10.1pt)
'FixedEmphasisFont'=("Courier New", 10.1pt)
'FixedStrongFont'=("Courier New", 10.1pt)
'FixedHeadingFont'=("Courier New", 10.1pt)
'BatchFixedFont'=("Courier New", 10.1pt)
'FixedFont'=("Courier New", 10.1pt)
'headingEmphasisFont'=("Times New Roman", 10.1pt)
'headingFont'=("Times New Roman", 10.1pt)
'docFont'=("Times New Roman", 10.1pt);
end;
run;
Then use an ODS PATH statement in your other programs to let SAS know that you have your own style templates.
options nodate;
libname process1 '/folders/myfolders/templates';
* MyStyle template has been saved to process1 library in a separate program ;
* use ods path statement to make custom templates available ;
ods path process1.tmplts(update) sashelp.tmplmst(read);
ods pdf
style=MyStyle
file='/folders/myfolders/templates/Example using custom template.pdf' ;
proc print data=sashelp.class;
run;
ods pdf close;
ods path reset;
The screen shot below shows the PROC PRINT using the custom style.
Use an ODS PATH statement when creating custom templates.
libname process1 '/folders/myfolders/templates';
ods path template.process1(update) sashelp.tmplmst(read);
proc template;
define style MyStyle /store=process1.tmplts;
Replace Table from Output /
frame=BOX
Rules=groups
cellpadding=2pt
borderspacing=0.75pt
borderwidth=0.75pt
borderstyle=solid;
Replace Body from Document /
topmargin=1in
bottommargin=1in
leftmargin=1in
rightmargin=1in;
parent=styles.sasdocPrinter;
replace fonts /
'TitleFont2'=("Times New Roman", 10.1pt)
'TitleFont'=("Times New Roman", 10.1pt)
'StrongFont'=("Times New Roman", 10.1pt)
'EmphasisFont'=("Times New Roman", 10.1pt)
'FixedEmphasisFont'=("Courier New", 10.1pt)
'FixedStrongFont'=("Courier New", 10.1pt)
'FixedHeadingFont'=("Courier New", 10.1pt)
'BatchFixedFont'=("Courier New", 10.1pt)
'FixedFont'=("Courier New", 10.1pt)
'headingEmphasisFont'=("Times New Roman", 10.1pt)
'headingFont'=("Times New Roman", 10.1pt)
'docFont'=("Times New Roman", 10.1pt);
end;
run;
Then use an ODS PATH statement in your other programs to let SAS know that you have your own style templates.
options nodate;
libname process1 '/folders/myfolders/templates';
* MyStyle template has been saved to process1 library in a separate program ;
* use ods path statement to make custom templates available ;
ods path process1.tmplts(update) sashelp.tmplmst(read);
ods pdf
style=MyStyle
file='/folders/myfolders/templates/Example using custom template.pdf' ;
proc print data=sashelp.class;
run;
ods pdf close;
ods path reset;
The screen shot below shows the PROC PRINT using the custom style.
Thank you so much; I appreciate your help!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.