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

Hello,

 

I switched to using proc odstext from 'ods rtf text=' statements because the latter did not allow page breaks to work. But proc odstext is giving me some issues with my text justification. Specifically, it will not center-justify text that does not exceed a certain length.


For example, the output of the following is centered:

proc odstext;
p "^S={font_size= 9pt font_style= italic just= c}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx."; run;

But the output of the following stays left-justified:

proc odstext;

p "^S={font_size= 9pt font_style= italic just= c}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.";

run;

I have tried to find the exact threshold, but it's a little difficult to tell when the line is exactly the length of the page whether the text is definitely centered or not.

Am I missing something obvious here?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Here's the tip sheet:https://support.sas.com/rnd/base/ods/Tipsheet_ListTextBlks.pdf

 

  The techniques shown on the tip sheet worked for me without needing ESCAPECHAR.

 

Hope this helps,

cynthia

 

proc_odstext.png

View solution in original post

6 REPLIES 6
Cynthia_sas
SAS Super FREQ

Hi:

  Here's the tip sheet:https://support.sas.com/rnd/base/ods/Tipsheet_ListTextBlks.pdf

 

  The techniques shown on the tip sheet worked for me without needing ESCAPECHAR.

 

Hope this helps,

cynthia

 

proc_odstext.png

sm4
Quartz | Level 8 sm4
Quartz | Level 8

 

I saw this right after I posted myself, thank you!

 

 

sm4
Quartz | Level 8 sm4
Quartz | Level 8

Nevermind - turns out you have to include 'just=' separately:

 

		p "^S={font_style= italic just= c}hello"/style=[just=c];

 

ballardw
Super User

Perhaps you need to look at the examples for Proc ODSTEXT a bit more. For style elements affecting an entire P statement the syntax should look a bit more like:

 

proc odstext;
p "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx." /
  style=[font_size= 9pt font_style= italic just= c];
run;
proc odstext;
p "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx." /
  style=[font_size= 9pt font_style= italic just= c];
run;

 

Or perhaps:

proc odstext;
p "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx." /
  style=[font_size= 9pt font_style= italic just= c];
p "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx." /
  style=[font_size= 9pt font_style= italic just= c];
run;

 

Also which ODS destination are you using? For destinations that will honor the Papersize option that may help.

 

I note in my html results that resizing the window can make the text appear not centered relative to the other line of text when the window is reduced in width.

Cynthia_sas
SAS Super FREQ
Hi:
I agree with @ballardw. There is no need to use ODS ESCAPECHAR when there is syntax that will do everything you want by adapting to the style override method shown in our examples and the tip sheet.

cynthia
sm4
Quartz | Level 8 sm4
Quartz | Level 8

I see, thank you! 

I am using RTF. Mostly formatting varies within my statements, but I will switch to that when it doesn't.

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
  • 6 replies
  • 3916 views
  • 5 likes
  • 3 in conversation