Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!

How to control the outlinelevel of a text output by "ods rtf" statement

Reply
New Contributor
Posts: 4

How to control the outlinelevel of a text output by "ods rtf" statement

ods rtf file="C:\Users\user\Desktop\test.rtf";
data t;
a='';
run;
proc report data=t  
style={protectspecialchars=off
frame=void rules=none font_size=10.5 fontweight=bold posttext = "\outlinelevel3\ {title1:this is a test} \par"};
column a;
define a/noprint;
run;
ods rtf close;

I tried to generate a report automaticly by ODS RTF statement and to control the outlinelevel of the text"title1:this is a test".

 

But nothing was output when I ran this code.

I just found this code works only if  remove the 'noprint' option.But this will cause the output of the data that i dont want.

Pls help on this,Many thanks.

SAS Super FREQ
Posts: 9,436

Re: How to control the outlinelevel of a text output by "ods rtf" statement

[ Edited ]

Hi:
I don't understand your code. NOPRINT is used in PROC REPORT to suppress the visibility of a column. Since A was just a space, I don't understand the purpose of the variable. It seems that you wanted to have some kind of string "this is a test" defined in RTF control strings as outlinelevel3 -- I don't understand what that would LOOK like in the RTF file. But since you were hanging the posttext onto an unknown part of PROC REPORT (did you mean to have style(report) there?) once you suppress A, there's no report for PROC REPORT to display. And, POSTTEXT would put the text at the BOTTOM of the report, or AFTER any text in a report cell, is that what you want? Also, if all you want to do is suppress the headers, there is a NOHEADER option for PROC REPORT that will work. If you are trying to insert items into your own TOC with OUTLINELEVEL3, this may be relevant: http://www2.sas.com/proceedings/forum2007/097-2007.pdf and http://support.sas.com/resources/papers/proceedings11/116-2011.pdf and http://www2.sas.com/proceedings/forum2008/238-2008.pdf .

 

There are other ways to write text, but without knowing what this would look like or what outlinelevel3 does, it is hard to speculate.

Cynthia

New Contributor
Posts: 4

Re: How to control the outlinelevel of a text output by "ods rtf" statement

Posted in reply to Cynthia_sas

Hi Cynthia, Thanks for your reply and papers.

You right,a (report) in style statement was missed.

Please refer to the image below,I want to keep the text"title1: this is a text" which highlighted ,and remove the variable named x .But the"define(x)/noprint" option didnt work at all.Do you know any other ways to set outlinelevel?

无标题.png

SAS Super FREQ
Posts: 9,436

Re: How to control the outlinelevel of a text output by "ods rtf" statement

Hi: I'm stumped -- you must not have sent all your code because I don't see anything in your posted code that refers to X in dataset WORK.T.

Sorry,

Cynthia
New Contributor
Posts: 4

Re: How to control the outlinelevel of a text output by "ods rtf" statement

Posted in reply to Cynthia_sas
ods rtf file="C:\Users\user\Desktop\test.rtf";
data t;
x=" ";
run;
proc report data=t  
style(report)={protectspecialchars=off
frame=void rules=none font_size=10.5 fontweight=bold posttext = "\outlinelevel3\ {title1:this is a test}  \par"};
run;
column x;
define x/center;
ods rtf close;

Hi Cynthia,look at this

 

SAS Super FREQ
Posts: 9,436

Re: How to control the outlinelevel of a text output by "ods rtf" statement

Hi:
You should have the RUN immediately before your ODS RTF CLOSE; -- NOT before your COLUMN statement. Is this program producing any output for you? It is probably producing all the defaults, but you should also be seeing error messages in the log. In my posting on Friday, I suggested you look in the documentation for the NOHEADER option on the PROC REPORT statement. Did you do that? I believe that would help you here once you correct your other mistakes.

Cynthia
New Contributor
Posts: 4

Re: How to control the outlinelevel of a text output by "ods rtf" statement

Posted in reply to Cynthia_sas

Hi Cynthia,

 

"NOHEADER" option is a good choice.That's what I want.

 

Thanks a lot!

Marakesh

Ask a Question
Discussion stats
  • 6 replies
  • 130 views
  • 0 likes
  • 2 in conversation