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
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;.
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.
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
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;.
Thank you so much for your help and solution.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.