BookmarkSubscribeRSS Feed
BigPete
Obsidian | Level 7

Hi guys. When involving the inline {^style[...]...} command within another, it seems to push off anything by 1 space after it no matter what as you can see in the PDF attachment. Does anyone know a workaround or quick fix to eliminate that gap without truncating any character that follows it?

 

Feel free to try my test code below:

%let w_httpa=http://www.testa.com/test.html;
%let w_httpb=http://www.testb.com/;
%let w_httpc=http://www.testc.com;

ods escapechar='^';

ods pdf file="C:\Users\pete\Desktop\SAS ODS PDF test\test.pdf" notoc startpage=Never;

ods pdf text="^{style[font_face='Times New Roman' fontweight=bold fontsize=11pt textdecoration=underline]Test 1}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test A ^{style[foreground=blue](&w_httpa)}. Again, Test A.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]2. It's Test B ^{style[foreground=blue](&w_httpb)}. Again, Test B.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]3. It's Test C ^{style[foreground=blue](&w_httpc)}. Again, Test C.}";

ods pdf text='^{newline 1}';
ods pdf text="^{style[font_face='Times New Roman' fontweight=bold fontsize=11pt textdecoration=underline]Test 2}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test A ( ^{style[foreground=blue]&w_httpa}). Again, Test A.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]2. It's Test B ( ^{style[foreground=blue]&w_httpb}). Again, Test B.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]3. It's Test C ( ^{style[foreground=blue]&w_httpc}). Again, Test C.}";

ods pdf text='^{newline 1}';
ods pdf text="^{style[font_face='Times New Roman' fontweight=bold fontsize=11pt textdecoration=underline]Test 3}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test A ( ^{style[foreground=blue]&w_httpa^{style[foreground=black])}}. Again, Test A.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]2. It's Test B ( ^{style[foreground=blue]&w_httpb^{style[foreground=black])}}. Again, Test B.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]3. It's Test C ( ^{style[foreground=blue]&w_httpc^{style[foreground=black])}}. Again, Test C.}";

ods pdf text='^{newline 1}';
ods pdf text="^{style[font_face='Times New Roman' fontweight=bold fontsize=11pt textdecoration=underline]Test 4}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test A (}^{style[font_face='Times New Roman' fontsize=10pt foreground=blue]&w_httpa}^{style[font_face='Times New Roman' fontsize=10pt]). Again, Test A.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test B (}^{style[font_face='Times New Roman' fontsize=10pt foreground=blue]&w_httpb}^{style[font_face='Times New Roman' fontsize=10pt]). Again, Test B.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test C (}^{style[font_face='Times New Roman' fontsize=10pt foreground=blue]&w_httpc}^{style[font_face='Times New Roman' fontsize=10pt]). Again, Test C.}";

ods pdf text='^{newline 1}';
ods pdf text="^{style[font_face='Times New Roman' fontweight=bold fontsize=11pt textdecoration=underline]Test 5}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test A (}%cmpres(^{style[font_face='Times New Roman' fontsize=10pt foreground=blue]&w_httpa})^{style[font_face='Times New Roman' fontsize=10pt]). Again, Test A.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test B (}%cmpres(^{style[font_face='Times New Roman' fontsize=10pt foreground=blue]&w_httpb})^{style[font_face='Times New Roman' fontsize=10pt]). Again, Test B.}";
ods pdf  text="^{style[font_face='Times New Roman' fontsize=10pt]1. It's Test C (}%cmpres(^{style[font_face='Times New Roman' fontsize=10pt foreground=blue]&w_httpc})^{style[font_face='Times New Roman' fontsize=10pt]). Again, Test C.}";

ods pdf close;
2 REPLIES 2
ballardw
Super User

It would probably help to show us what you are trying to generate. I am not sure what your goal is or exactly where your "push off anything by 1 space" is.

You might want to look at Proc ODSTEXT as an alternative if you are generating blocks of text as the syntax for appearance may be easier than that many inline calls.

BigPete
Obsidian | Level 7

To close the gap between the quoted website and closing parenthesis. Instead of seeing "...html )", "...com/ )", or "...com )", trying to achieve the same result as Test 1 except the closing parenthesis not being blue.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2065 views
  • 0 likes
  • 2 in conversation