BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello, I am using a proc format because most of my text is left justify but I would like to use the title option or any other option that will works with SAS EG 5.1 and that will permits me to put some line of text justify = center as below

 

This is my first line of text

This is my second line of text

 

                                    This is my first title

 

This is my third line of text.

 

You will find my code below.  The title option is not recognized at all.  Any suggestion?

 

ods path work.tmp(update) sasuser.templat(update) sashelp.tmplmst(read);

ODS _ALL_ CLOSE;

proc template;

define style Styles.UserText;

parent = Styles.Default;

CLASS UserText from SystemTitle /

just=Left

FONT_FACE = "Arial, Helvetica, sans-serif"

fontstyle=roman

fontsize=12pt

fontweight=bold

color=black;

end;

run;

ods escapechar='^';

ods tagsets.rtf file='\\AHOMEDIRPNAS\Homedirp\ALE252\Travail\Temp2\test4.rtf' startpage=no style=Styles.UserText options (Tables_OFF='usertext');

ods tagsets.rtf text='this is a text line';

ods tagsets.rtf text="^{style[ color = red font_size=14pt font_style=italic] This is a second line of text}";

ods tagsets.rtf text="^{style[ just=c color= blue font_size=14pt textdecoration=underline font_style=italic]Conclusion}";

title h=14pt color=black bold 'this is a sas title';

ods tagsets.rtf close;

 

The result is:

 

this is a text line

This is a second line of text

Conclusion

 

 

 

 

 

 

 

4 REPLIES 4
Kurt_Bremser
Super User

A title defined with a title statement will be added to the output created by procedures that produce output. The title statement just defines the title, but does not add anything to the output. Once a subsequent procedure creates output, the defined title(s) will be added to the output automatically.

 

Your code has no output procedure.

Kurt_Bremser
Super User

PS do this for a test:

ods path work.tmp(update) sasuser.templat(update) sashelp.tmplmst(read);
ODS _ALL_ CLOSE;
proc template;
define style Styles.UserText;
parent = Styles.Default;
CLASS UserText from SystemTitle /
just=Left
FONT_FACE = "Arial, Helvetica, sans-serif"
fontstyle=roman
fontsize=12pt
fontweight=bold
color=black;
end;
run;
ods escapechar='^';
ods tagsets.rtf file='\\AHOMEDIRPNAS\Homedirp\ALE252\Travail\Temp2\test4.rtf' startpage=no style=Styles.UserText options (Tables_OFF='usertext');
ods tagsets.rtf text='this is a text line';
ods tagsets.rtf text="^{style[ color = red font_size=14pt font_style=italic] This is a second line of text}";
ods tagsets.rtf text="^{style[ just=c color= blue font_size=14pt textdecoration=underline font_style=italic]Conclusion}";
title h=14pt color=black bold 'this is a sas title';

proc print data=sashelp.class;
run;

ods tagsets.rtf close;
alepage
Barite | Level 11

Thanks you Kurt!  In that case, the title option may not be appropriate for what I would like to do.

 

If you looks at my original code, the third line of text as an justify option but it is not working.

ods tagsets.rtf text="^{style[ just=c color= blue font_size=14pt textdecoration=underline font_style=italic]Conclusion}";

 

The word Conclusion is blue, italic, underline but justify = left, the justification from the proc format. Is there a way to change the justification of a line of text with ods tagsets.rtf text?

 

Regards,

Alain

 

 

Kurt_Bremser
Super User

Since ods text delivers raw text to the destination, I have an inkling that just=c is not valid rtf style syntax, and the justification needs to be delivered differently.

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
  • 4 replies
  • 1313 views
  • 0 likes
  • 2 in conversation