I have a program that I need to run multiple times to produce reports for multiple school districts (using ODS PDF). I use the following to title my pages.
Before running my program,
%LET DISTNAME = Example;
Within my program,
TITLE1 "&DISTNAME.".;
This works fine for me. I would also like to add some descriptive text using ODS PDF TEXT= and mention the district name in the text. How do I do that?
ODS PDF TEXT = '^S={just=center font=("Times New Roman",14PT,Bold)} Report produced for &DISTNAME. ISD';
is not working.
I see why. Font name needs to be enclosed in single quotes when the overall text enclosed in double quotes.
Please see the example below.
%LET DISTNAME = Example;
ods escapechar='^';
TITLE1 "&DISTNAME.";
ods pdf file='d:\temp\test.pdf';
proc print data=sashelp.class;
run;
ODS PDF TEXT = "^S={just=center font=('Times New Roman',14PT,Bold)} Report produced for &DISTNAME. ISD";
%* ODS PDF TEXT = "^S={just=center font=(""Times New Roman"",14PT,Bold)} Report produced for &DISTNAME. ISD"; //* This would work, too */
ods pdf close;
Can you try enclosing in double quotes instead of single?
ODS PDF TEXT = "^S={just=center font=("Times New Roman",14PT,Bold)} Report produced for &DISTNAME. ISD";
No, that didn't work either ...
I see why. Font name needs to be enclosed in single quotes when the overall text enclosed in double quotes.
Please see the example below.
%LET DISTNAME = Example;
ods escapechar='^';
TITLE1 "&DISTNAME.";
ods pdf file='d:\temp\test.pdf';
proc print data=sashelp.class;
run;
ODS PDF TEXT = "^S={just=center font=('Times New Roman',14PT,Bold)} Report produced for &DISTNAME. ISD";
%* ODS PDF TEXT = "^S={just=center font=(""Times New Roman"",14PT,Bold)} Report produced for &DISTNAME. ISD"; //* This would work, too */
ods pdf close;
Alpay, that worked, thank you!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.