BookmarkSubscribeRSS Feed
Ken_oy
Fluorite | Level 6

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;

8 REPLIES 8
shivas
Pyrite | Level 9

Hi..

How about using

options orientation=landscape papersize=A3;

Thanks,

Shiva

Ken_oy
Fluorite | Level 6

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

Ksharp
Super User

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

Ken_oy
Fluorite | Level 6

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".

Cynthia_sas
SAS Super FREQ

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

Ken_oy
Fluorite | Level 6

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

Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 7858 views
  • 0 likes
  • 4 in conversation