Help using Base SAS procedures

[proc report] Try to put 2 tables in 1 page

Reply
Frequent Contributor
Posts: 128

[proc report] Try to put 2 tables in 1 page

Wrote a SAS code to make an rtf file with tables. This code works in "portrait" mode, but it does not work in "landscape".

It seems SAS made more than enough "blank lines" in between tables, and pushed the second table to the next page.

Is there any way to fix this?

Please see the following SAS code I used. Thanks!

**================================================================;

ods escapechar='^';

options nodate number;

ods rtf body="&result"

style=styles.LNOTE bodytitle headery = 0 footery = 0  startpage = no;

options orientation=landscape number nodate nobyline;   ***(portrait works here);

ods rtf;

proc report data=t11(obs=10) headline headskip missing nowd split='@' spacing=0

             style(header column)=[protectspecialchars=off background=white]

             Style(report)={borderwidth=0.01pt cellspacing=0pt cellpadding=0.5pt  vjust=bottom}

             STYLE(HEADER)={ PROTECTSPECIALCHARS=off };

            

TITLE1 h = 10pt j = center color = black "Study (&fdate)";

title2 h = 10pt j = center color = black "Table 1. ";

*footnote1 justify=left "1. OCT stent luminal area minus MicroCT stent luminal area";

footnote justify=left " ";

footnote2 justify=left " ";

column panel label days_0 days_1 days_2 days_3 days_4 days_5 days_6;

define panel / group noprint;

define label /display " "    STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.3in just=l} STYLE(header)={asis=on  just=l};

define days_0 /display "Day0"   STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_1 /display "Day1"   STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_2 /display "Day2 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_3 /display "Day3 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_4 /display "Day4 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_5 /display "Day5 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_6 /display "Day6 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

run;

proc report data=t12 headline headskip missing nowd split='@' spacing=0

             style(header column)=[protectspecialchars=off background=white]

             Style(report)={borderwidth=0.01pt cellspacing=0pt cellpadding=0.5pt  vjust=bottom}

             STYLE(HEADER)={ PROTECTSPECIALCHARS=off };

            

TITLE1 h = 10pt j = center color = black "  ";

title2 h = 10pt j = center color = black "Table 2. ";

*footnote1 justify=left "1. OCT stent luminal area minus MicroCT stent luminal area";

footnote1 justify=left "2. ";

footnote2 justify=left " ";

column panel label days_0 days_1 days_2 days_3 days_4 days_5 days_6;

define panel / group noprint;

define label /display " "    STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.3in just=l} STYLE(header)={asis=on  just=l};

define days_0 /display "Day0"   STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_1 /display "Day1"   STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_2 /display "Day2 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_3 /display "Day3 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_4 /display "Day4 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_5 /display "Day5 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

define days_6 /display "Day6 "  STYLE(COLUMN)={asis=on PROTECTSPECIALCHARS=off cellwidth=1.10in just=c};

run;

ods rtf close;

Super Contributor
Posts: 349

Re: [proc report] Try to put 2 tables in 1 page

Hi..

How about using

options orientation=landscape papersize=A3;

Thanks,

Shiva

Frequent Contributor
Posts: 128

Re: [proc report] Try to put 2 tables in 1 page

Shiva, I tried your code, the paper size did change, but still, table1 in page1 and table2 in page2.

But thanks for your code. Smiley Happy

Super Contributor
Posts: 349

Re: [proc report] Try to put 2 tables in 1 page

Hi ken,

Check this link and Example 5.Hope it helps.

http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/viewer.htm#a003152286.htm

Thanks,

Shiva

Super User
Posts: 10,035

Re: [proc report] Try to put 2 tables in 1 page

You can use some options such as

options TOPMARGIN=0.1cm  BOTTOMMARGIN=0.1cm ;

to expand the size of a page, But I am not sure whether it can work, it is up to your report  size.

Ksharp

Frequent Contributor
Posts: 128

Re: [proc report] Try to put 2 tables in 1 page

Thanks Ksharp, I tried your code, but it is not working for me. There are still 5 blank lines in between two tables. I attached my output file in "reply6".

SAS Super FREQ
Posts: 8,866

Re: [proc report] Try to put 2 tables in 1 page

Hi:

  It's not clear to me whether you want your two tables on the same page -vertically- one above the other or -horizontally- one next to the other. To get your two tables on the  same page -vertically-, the STARTPAGE= NO option would work. To get your two tables on the same page -horizontally-, then you'd use COLUMNS=2, assuming that on a landscape page, with the right margins and fonts, there was enough room for the two tables to be placed next to each other. You seem to be really controlling your cellwidths. By my math, just one table comes out to 9 in wide for just one report (if you add up all the 1.10 + 1.3). I'm surprised that anything fits on a portrait page because the last time I checked, a portrait page was only 8.5 in for US papersize. And I don't know what papersize A3 is  and whether it is in inches or cm, but no matter what, when you use IN or CM for RTF, then must be converted to TWIPS for RTF, anyway -- so you have some size conversions going on. At any rate, it doesn't make sense to mix IN and CM, but specifying explicit margins and then making sure your cellwidths will fit inside the margins is one place to start. If STARTPAGE and COLUMNS don't give you want you want, then you may have to move outside of the original ODS RTF.

  The link posted for TAGSETS.RTF does show that there are some more controls that you can specify with that newer destination.

cynthia

Frequent Contributor
Posts: 128

Re: [proc report] Try to put 2 tables in 1 page

Posted in reply to Cynthia_sas

Thanks Cynthia for your reply. Sorry for not making my question clear.

I want two tables on the same page vertically (one above the other) in landscape mode.

And yes, you are right, if I use portrait, those two tables will not fit the paper width, and that is why I have to use "landscape".

But, I have to say, in portrait mode, two tables are "one above the other on the same page", no margin between them. But in "landscape", there are 5 blank line between two tables, so the second table will be pushed to the next page. I tried Ksharp's code (TOPMARGIN=0.1cm  BOTTOMMARGIN=0.1cm ;), and it does not seem to help for my problem. I attached the link of the output file in this reply.

P.S.: the same code worked just fine in SAS 9.1.3.

https://www.dropbox.com/s/0qi53zk9hcdmnr1/output.rtf

SAS Super FREQ
Posts: 8,866

Re: [proc report] Try to put 2 tables in 1 page

Hi:

  When you said "PS the same code worked just fine in SAS 9.1.3" -- that means you really need to work with Tech Support. For one thing, they need to investigate whether this is a  universal bug in ODS RTF or whether there's something that just needs a different option setting. If they investigate and discover that it's a bug, they will issue a Tech Support note and alert the developer that there's something that needs to be fixed. For some things, looking to the forum for answers is an OK approach, however, as soon as you uncover something that used to work, but now doesn't and it really is the SAME code and the only thing that changed was the version of SAS, then you need to work with Tech Support.

cynthia

Ask a Question
Discussion stats
  • 8 replies
  • 4115 views
  • 0 likes
  • 4 in conversation