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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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