The SAS Output Delivery System and reporting techniques

PROC ODSTEXT text justification is fickle

Accepted Solution Solved
Reply
Highlighted
Contributor sm4
Contributor
Posts: 27
Accepted Solution

PROC ODSTEXT text justification is fickle

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!


Accepted Solutions
Solution
a week ago
SAS Super FREQ
Posts: 9,039

Re: PROC ODSTEXT text justification is fickle

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


All Replies
Solution
a week ago
SAS Super FREQ
Posts: 9,039

Re: PROC ODSTEXT text justification is fickle

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

Contributor sm4
Contributor
Posts: 27

Re: PROC ODSTEXT text justification is fickle

[ Edited ]
Posted in reply to Cynthia_sas

 

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

 

 

Contributor sm4
Contributor
Posts: 27

Re: PROC ODSTEXT text justification is fickle

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

 

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

 

Super User
Posts: 12,148

Re: PROC ODSTEXT text justification is fickle

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.

SAS Super FREQ
Posts: 9,039

Re: PROC ODSTEXT text justification is fickle

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
Contributor sm4
Contributor
Posts: 27

Re: PROC ODSTEXT text justification is fickle

I see, thank you! 

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

☑ This topic is solved.

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

Discussion stats
  • 6 replies
  • 218 views
  • 4 likes
  • 3 in conversation