Help using Base SAS procedures

How to give different sub title names for two tables produced one ODS RTF with two proc reports

Reply
Super Contributor
Posts: 272

How to give different sub title names for two tables produced one ODS RTF with two proc reports

Dear,

I am using the following code to produce two tables with first one on first two pages and second one in next two pages.

 

I need to put same mainheading title on both tables and different subtitle names

 

Also the subheading characters need to be just above the header line without gap. Please help. Thank you very much

 

 

title1 "MAIN HEADING";

title2 justify=left "subheading1";

title3  justify=left "subheading2";

 

ods rtf file="c:\temp\both_reports_one_file.rtf";
 
proc report data=a1 center headskip nowd missing split='|'
style(report)={outputwidth=100% cellpadding=3 rules=groups frame=above}
style(header)={font_weight=bold fontsize=9pt fontstyle=ROMAN}
style(lines)={cellpadding=1 fontsize=3pt};
** proc report data=a2 enter headskip nowd missing split='|'
style(report)={outputwidth=100% cellpadding=3 rules=groups frame=above}
style(header)={font_weight=bold fontsize=9pt fontstyle=ROMAN}
style(lines)={cellpadding=1 fontsize=3pt};
ods rtf close;

 outputneeded:

 

                       MAIN HEADING

sub heading1

_________________________________

_________________________________

  

 

 

 

                  MAIN HEADING

sub heading2

________________________________

________________________________

  

 

SAS Super FREQ
Posts: 8,742

Re: How to give different sub title names for two tables produced one ODS RTF with two proc reports

[ Edited ]

Hi:
HEADLINE and HEADSKIP are ignored by ODS RTF. They are listing only options. What is the structure of your data? What is your COLUMN statement like? Your TITLE statement? Where is the rest of your PROC REPORT code?

It is impossible to make constructive suggestions without more information or with data to test. But even with data, somebody would have to pretend to understand what the rest of your program looked like, what your OPTIONS were and how many columns were on each report.

cynthia

Super Contributor
Posts: 272

Re: How to give different sub title names for two tables produced one ODS RTF with two proc reports

Sorry. Here is  my code: Thank you very much for your time.

 

options nonumber noquotelenmax orientation=landscape topmargin=1in leftmargin=0.6in bottommargin=0.7in rightmargin=1in linesize=256;
ods listing close;
ods escapechar = '^';
ods rtf file="\Desktop\a.rtf" style=rtfstyle;
title1 justify=right 'page ^{pageof}';
title2 "Table 1 Overall Summary of  (as) by oompliant and-oompliant Use of Therapy (Population)";
title3 justify=left "oompliant Use of a ";
%let s = %sysfunc(repeat(%str(_), 149 )) ;
footnote1 j=c h=1 "^S={fontstyle=ROMAN fontweight=bold}&s";

 

proc report data=all1 center headskip nowd missing split='|'
style(report)={outputwidth=100% cellpadding=3 rules=groups frame=above}
style(header)={font_weight=bold fontsize=9pt fontstyle=ROMAN}
style(lines)={cellpadding=1 fontsize=3pt};

column text ont_oct6 ont_oct1 ont_oct2 ont_oct3 ont_oct4 ont_oct5;

define text/ "Number (%) of Subjects with" style(column)={asis=on cellspacing=.2pt just=left width=25%} style(HEADER)={JUST=l} flow;
define ont_oct6/ "Placebo|N=&e" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_oct1/ "07.5 mg|N=&a" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_oct2/ "05 mg|N=&b" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_oct3/ "050 mg|N=&c" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_oct4/ "000 mg|N=&d" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow ;
define ont_oct5/"Combined|dd|N=&f" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
run;

 

proc report data=all2 center headskip nowd missing split='|'
style(report)={outputwidth=100% cellpadding=3 rules=groups frame=above}
style(header)={font_weight=bold fontsize=9pt fontstyle=ROMAN}
style(lines)={cellpadding=1 fontsize=3pt};

column text ont_pct6 ont_pct1 ont_pct2 ont_pct3 ont_pct4 ont_pct5;

define text/ oumber (%) of Subjects with" style(column)={asis=on cellspacing=.2pt just=left width=25%} style(HEADER)={JUST=l} flow;
define ont_pct6/ "olacebo|N=&e" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_pct1/ "07.5 mg|N=&a" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_pct2/ "05 mg|N=&b" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_pct3/ "050 mg|N=&c" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
define ont_pct4/ "000 mg|N=&d" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow ;
define ont_pct5/"0ombined|DD|N=&f" style(column)={cellspacing=.25pt just=left width=8%} style(HEADER)={JUST=l} flow;
run;


ods rtf close;

SAS Super FREQ
Posts: 8,742

Re: How to give different sub title names for two tables produced one ODS RTF with two proc reports

Hi:
  Here are some comments on your code. Without data, all I can offer are some general comments.

--If you want a line under the table, not sure why you're not just using STYLE=JOURNAL.

 

--There seems to be at least one problem with mismatched quotes in one of your DEFINE statements...
define text/ oumber (%) of Subjects with" style
(missing quote after slash /)

 

--Also, it appears that you are trying to write dividing lines in your code
%let s = %sysfunc(repeat(%str(_), 149 )) ;
footnote1 j=c h=1 "^S={fontstyle=ROMAN fontweight=bold}&s";
instead of using the more common method of specifying RTF control strings to put a line in the footnote or using the technique in this Tech Support note http://support.sas.com/kb/46/383.html.

 

--Using a custom style (style=rtfstyle) -- did you make that with PROC TEMPLATE?

--FLOW, like HEADLINE and HEADSKIP is ignored by ODS RTF -- so that option will be ignored. Not sure why you're using it, since it has no impact.

 

--LINESIZE in your OPTIONS statement will also be ignored by ODS RTF. So it is unnecessary, because the margin options are controlling ODS RTF along with orientation=landscape.

 

--Not sure about your style(lines) -- here's why --
style(lines) will only be used if you have a LINE statement in your PROC REPORT code and I don't see a LINE statement anywhere.

 

--About spacing between or before tables, I'd recommend looking up the use of PARSKIP -- this previous forum posting discusses it:
https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-RTF-gap-between-tables/td-p/64768 and this posting https://communities.sas.com/t5/ODS-and-Base-Reporting/remove-the-blank-line-between-the-titile-and-t...

 

  That's what I feel comfortable commenting on -- perhaps other folks doing this type of report have some additional comments/suggestions. 

 

cynthia

Super User
Posts: 10,485

Re: How to give different sub title names for two tables produced one ODS RTF with two proc reports

The generic approach would be something like

 

ods <destination>

Title1 "title1 text";

 

 

Title2 "sub title for procedure1";

proc report;

 

Title2 "subtitle for next procedure";

proc report;

 

title; /* to clear titles after I'm done with them*/

ods destination close;

 

You have up to 10 title statements to work with and they persist until redefined or cleared by defining a lower numbered title.

Ask a Question
Discussion stats
  • 4 replies
  • 169 views
  • 2 likes
  • 3 in conversation