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

Hi,

 

I need help with ODS RTF template, proc report column width. I would like to control column width in output. But somehow all spaces are truncating.

 

Below is my code,

 

options orientation = landscape ls=140 ps=45 nocenter nobyline nodate nonumber ;
options noxwait noxsync mlogic nosymbolgen mprint missing = '' formchar='|_---|+|---+=|-/\<>*' ;

proc template;
define style myrtfstyle;
parent=styles.rtf;
style Table from output /
background=_undef_
Rules=groups
Frame=void
just=center
font=("Courier New", 9pt)
cellpadding = 1pt
cellspacing = 0pt
borderwidth = 0.5pt ;

style rowheader /
background=white
font=("Courier New", 11pt, bold)
;
style header /
background=white
font=("Courier New", 8.5pt, bold)
;
style systemtitle /
font=("Courier New", 8.5pt, bold)
;
style systemfooter /
font=("Courier New", 8.5pt, bold)
asis=on
;
style data /
font=("Courier New", 8.5pt)
;
replace Body from Document
"Controls the Body file." /
bottommargin = 1 in
topmargin = 1.25 in
rightmargin = 0.6 in
leftmargin = 0.8 in
;
end;
run;

ods escapechar="^";

data class;
set sashelp.class;
if name="Alice" then name=" Alice";
run;

ods listing close;
ods rtf file="U:\delete\output.rtf" style=myrtfstyle;

proc report data=class nocenter headline headskip missing split="~" spacing=10 nowd;
column name sex age height weight;

define name / display order "Name" left width=40 ;
define sex / display "Sex" left width=40 flow;
define age / display "Age" left width=40 flow;
define height / "Height" left width=40 flow;
define weight / "Weight" left width=40 flow;

break after name /skip;

title1 j=c "Summary Body Weight (kg) by Visit" j=r "page ^{pageof}";
footnote1 j=c "%sysget(SAS_EXECFILENAME)";
run;

 

ods rtf close;
ods listing;

 

Thanks in advance.

Saurabh


Capture.JPG
1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, good idea to formulate your questions clearly, giving examples.  Skip does not do anything in ods rtf, have a read of Cynthia's post in:

https://communities.sas.com/t5/SAS-Enterprise-Guide/Break-and-Skip-statement/td-p/56082

 

You can emulate the skip by adding a compute + line " "; + endcomp;.

 

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

So, you have put spaces before the word "Alice" yes, and you want them to show in your output.  Then you need to update this line:

define name / display order "Name" left width=40 ;

 

To read:

define name / display order "Name" left width=40 style={asis=on};

 

Its a tricky option to find any information on this one.

saurabh
Calcite | Level 5

Hello,

 

Thank you so much for your inputs, yes with option asis=on working, But break after/skip options is still not working.

 

Regards,

Saurabh

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, good idea to formulate your questions clearly, giving examples.  Skip does not do anything in ods rtf, have a read of Cynthia's post in:

https://communities.sas.com/t5/SAS-Enterprise-Guide/Break-and-Skip-statement/td-p/56082

 

You can emulate the skip by adding a compute + line " "; + endcomp;.

 

saurabh
Calcite | Level 5

Thank you so much for your help and solution.

 

 

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
  • 4045 views
  • 0 likes
  • 2 in conversation