BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AshP
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Alpay
Fluorite | Level 6

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;

View solution in original post

4 REPLIES 4
Alpay
Fluorite | Level 6

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";

AshP
Calcite | Level 5

No, that didn't work either ...

Alpay
Fluorite | Level 6

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;

AshP
Calcite | Level 5

Alpay, that worked, thank you!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 4050 views
  • 1 like
  • 2 in conversation