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

Hi - I have seen on various posts (including this one; Determining ods pdf text size) that to change the font size of ODS PDF TEXT, a style template such as in the following code can be used.  Unfortunately this does not change the font size of text within PROC ODSTEXT and I do not want to add style modifiers to each occurrence of PROC ODSTEXT.

 

 

Proc template;
Define style Style.Custom;
parent=styles.default;
style usertext from usertext /
      font_size=18pt
      font_weight=bold;
end;
run;

ods pdf file='c:\temp\use_bold.pdf' style=Style.Custom ;
    
ods escapechar='^';
options nodate;
title 'Using PROC ODSTEXT';
footnote 'The ODS Destination for PDF';
proc odstext;
   p 'The following word is styled; ^{style[color=purple fontweight=bold]HERE}^{newline 2}';
   p 'You can ^{style[textdecoration=underline]also} format your text.' / style=[color=red];
run;

ods pdf text="Only this font size is 18pt";
ods _all_ close;

This code gives the following:

sashelp.PNG

 

How can I determine the style element to adjust to change all font sizes for PROC ODSTEXT / how should the template be modified?  

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Chevell_sas
SAS Employee

Use the Paragraph style element for the PROC ODSTEXT statement and the Usertext for the ODS TEXT=. Try the below and this should give you the desired results.

 

Proc template;

Define style Style.Custom;

 parent=styles.default;

  class usertext /

    font_size=18pt

        font_weight=bold;

   style paragraph from usertext;

end;

run;

ods pdf file='c:\temp\use_bold1.pdf' style=Style.Custom ;

 

ods escapechar='^';

options nodate;

title 'Using PROC ODSTEXT';

footnote 'The ODS Destination for PDF';

 

proc odstext;

p 'The following word is styled; ^{style[color=purple fontweight=bold]HERE}^{newline 2}';

p 'You can ^{style[textdecoration=underline]also} format your text.' / style=[color=red];

run;

ods pdf text="Only this font size is 18pt";

ods _all_ close;

View solution in original post

2 REPLIES 2
Chevell_sas
SAS Employee

Use the Paragraph style element for the PROC ODSTEXT statement and the Usertext for the ODS TEXT=. Try the below and this should give you the desired results.

 

Proc template;

Define style Style.Custom;

 parent=styles.default;

  class usertext /

    font_size=18pt

        font_weight=bold;

   style paragraph from usertext;

end;

run;

ods pdf file='c:\temp\use_bold1.pdf' style=Style.Custom ;

 

ods escapechar='^';

options nodate;

title 'Using PROC ODSTEXT';

footnote 'The ODS Destination for PDF';

 

proc odstext;

p 'The following word is styled; ^{style[color=purple fontweight=bold]HERE}^{newline 2}';

p 'You can ^{style[textdecoration=underline]also} format your text.' / style=[color=red];

run;

ods pdf text="Only this font size is 18pt";

ods _all_ close;

Cynthia_sas
SAS Super FREQ
Hi:
I believe the spacing is inconsistent because I added a ^{newline 2} to the example I used in another forum posting. I recommend you take that out if you want "single spacing" but remember that every font is designed with a certain amount of "buffer" space around each character based on font size. So, for example, in the red line, there is less space between the 'L' and the 's' in the word also, then there is between the 'i' and the 's' in is in your 18pt line. So based on the font size, the cushion around the letters could be a different amount of space.

And, as Chevell explained, the USERTEXT style element is for ODS TEXT statements only. The PARAGRAPH style element controls the paragraphs in the PROC ODSTEXT.

cynthia

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
  • 2 replies
  • 12396 views
  • 1 like
  • 3 in conversation