The SAS Output Delivery System and reporting techniques

Change font size for all "PROC ODSTEXT" text

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 84
Accepted Solution

Change font size for all "PROC ODSTEXT" text

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.


Accepted Solutions
Solution
‎06-30-2016 06:55 PM
SAS Employee
Posts: 88

Re: Change font size for all "PROC ODSTEXT" text

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


All Replies
Solution
‎06-30-2016 06:55 PM
SAS Employee
Posts: 88

Re: Change font size for all "PROC ODSTEXT" text

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;

SAS Super FREQ
Posts: 8,864

Re: Change font size for all "PROC ODSTEXT" text

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
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 1781 views
  • 1 like
  • 3 in conversation