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

I'm producing multi-page detailed reports with long text strings as well as graphs and tables. The text strings are used for titles on pages, as well as tables and graphs. Long text strings are also used for detailed explanations of the report contents. I'm using ODS LAYOUT with multiple regions to control each page. The document is written to a PDF.  To maximize control over the text strings, I'm using ODS TEXT="....." with ods escapechar inline formatting for fine formatting needs such as bolding specific pieces of text. 

Here's the text I'm using:

ods text="~{style[font_size=3.25 just=c]Antibiotic Stewardship Across 3 Common Childhood Conditions}";
ods text="~{style[font_size=3.25 just=c]Provider-Specific Data for ~{style[just=c fontweight=bold fontstyle=italic] &prov_full_no_quote.}} ";

ods text="~{style[font_size=3.25 just=c]Ambulatory Care 1/2014 - 6/2020}";

 

All of these text lines should be centered. The second line of text comes out left justified while the first and third line are centered. (see sample output below.)

This is one example. I am seeing this behavior intermittently throughout the document. I've tried changing the sequence of the inline formatting commands. 

Anyone have suggestions for me?

 

 

kareng_1-1600972713938.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Is there any chance that your macro variable has some non-printing characters past the desired text? That might make the centering calculation think that the string to center is much longer than appears visible.

 

You might try dropping the second Just = in the style as well.

View solution in original post

5 REPLIES 5
kareng
Calcite | Level 5

I now see a pattern in when the just=c inline formatting doesn't occur. It's whenever the line of text includes a macro var. The macro does successfully resolve, but could this this a timing issue of resolution of the macro preventing the proper formatting?

ballardw
Super User

Is there any chance that your macro variable has some non-printing characters past the desired text? That might make the centering calculation think that the string to center is much longer than appears visible.

 

You might try dropping the second Just = in the style as well.

kareng
Calcite | Level 5

Ah yes. Thanks for your suggestion. Although I knew the length of the var going into the macro, it was GROWING behind the scenes. I added %sysfunc(strip(&macro_var))   and the output is now properly centered.

Tom
Super User Tom
Super User

@kareng wrote:

Ah yes. Thanks for your suggestion. Although I knew the length of the var going into the macro, it was GROWING behind the scenes. I added %sysfunc(strip(&macro_var))   and the output is now properly centered.


It is probably easier to just not put the trailing spaces into the macro variable to begin with.

Use CALL SYMPUTX() instead of the older CALL SYMPUT().  Use the TRIMMED keyword in PROC SQL.

data _null_;
  set myds;
  call symputx('mymvar',mydsvar);
run;
proc sql noprint;
select mydsvar into :mymvar trimmed from myds;
quit;
kareng
Calcite | Level 5

I thought I had handled the training spaces by using this code to populate the macro in PROC SQL:

compbl(trimn(left(complete_title))) into: &prov_full_no_quote.

 

I was not previously aware of the PROC SQL keyword TRIMMED. Thanks!

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 616 views
  • 0 likes
  • 3 in conversation