BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
sah_biostat
Fluorite | Level 6
I have used panel =option.But it doesn't work since I am generating RTF report.
Can anybody please throw some light on how can we create proc report output in single page with different columns?
Thanks in advance
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Panels is a PROC REPORT option that is a LISTING only option, so it won't work with ODS RTF. However, both RTF and PDF support the COLUMNS= option, which is what I used to print these 2 pages from some fake data:

Cynthia_sas_0-1673567330886.png

And you will notice that on a letter sized (8.5x11) page, with an 8pt font and a cellpadding of 3px, I can get approximately 60 rows on a page and with columns=2 option turned on, I can get approximately 120 rows per page. I used a very basic version of your code but took out the percent specification for headers because I find it better to not try to overcontrol column widths until I get most of the report the way I want. It was pretty clear from the OP that the existing code did not really work. So I started very basic. Of course, any change in cellpadding or font size is going to change the number of rows and columns that can fit on a page. Also, for options, I prefer to specify my own margins after I specify a papersize. I chose letter because I may want to print this and letter is the size of paper in my printer.

  Here's the code I used to get 2 pages with 2 columns per page:

Cynthia_sas_1-1673567726765.png

I tried with columns=4 as the only change on the ODS RTF statement and with that same font size (8pt) I was able to get all 200 rows on 1 page:

Cynthia_sas_2-1673567857848.png

So, I think that going back to some of the basic ODS RTF options and not trying to use LISTING options and changing your font size should allow you to get either 2 pages or 1 page for your 200 rows.

Cynthia

View solution in original post

17 REPLIES 17
sah_biostat
Fluorite | Level 6

@Kurt_Bremser ,

Thanks for your reply.

I have used the papersize option but no use.

Thanks for your time

ballardw
Super User

It almost never hurts to include your code. With RTF output you want to include all the ODS RTF (or Tagsets.RTF) options as well as Proc Report code. Better would be include data in the form of a working data set.

 

By "single page" do you mean you current report is only wrapping columns because of width or is it also too long to fit the number of rows?

 

Appearance such as smaller fonts might suffice if we are only talking one or two columns. Try a different ODS style such as Meadow if you are using the default RTF style.

Column headings might make columns wider than needed and the SPLIT option might help.

Did you define widths larger than needed to display the actual values?

Options like Cellpadding can reduce white space.

 

And others, which is why I suggest the code you use.

 

sah_biostat
Fluorite | Level 6
Thank you so much for your swift reply and for apt explanation.
Actually my table is having only two columns with 200 observation(for this request but in future number can increase).
My query here is,as this is client requirement to see all the values in the one page like these 200 observation should populate side by side in one page.
Is this possible?
ballardw
Super User

@sah_biostat wrote:
Thank you so much for your swift reply and for apt explanation.
Actually my table is having only two columns with 200 observation(for this request but in future number can increase).
My query here is,as this is client requirement to see all the values in the one page like these 200 observation should populate side by side in one page.
Is this possible?

One thing I have done in the past is to use work processor tools to display a table in more than one column for a table.

Again, suggest showing your current code.

And perhaps @Cynthia_sas might have an idea on how to modify that code.

sah_biostat
Fluorite | Level 6

Hello @ballardw ,

 

I have implemented your inputs but still getting the output in 3 pages.As of now i have tried on 50 observations. As per the request we need the output in only 2 pages(one is the front page and another is for the all observations).In my output I am getting 26 observations in one page and 24 observations in the other.My requirement here is to get all the observations in one page side by side.

I am putting simple code of mine here only for this particular not for the front page since i cannot see any issues on the front page. For safety reasons I have masked the words of the column headers but the length is same.

Code:

options ps=max ls=max papersize=max;
proc report data=final style(report)={cellpadding=5};
column order spid;
define order /display "xxxxx to select the xxxxxxxx" STYLE (HEADER) = {JUST=C CELLWIDTH=10%};
define spid /display "xxxxxxxx xxxxxx from the xxxxxxx list of the xxxx" STYLE (HEADER) = {JUST=C CELLWIDTH=10%};
run;

Thanks for your time

Cynthia_sas
SAS Super FREQ

Hi:

  Panels is a PROC REPORT option that is a LISTING only option, so it won't work with ODS RTF. However, both RTF and PDF support the COLUMNS= option, which is what I used to print these 2 pages from some fake data:

Cynthia_sas_0-1673567330886.png

And you will notice that on a letter sized (8.5x11) page, with an 8pt font and a cellpadding of 3px, I can get approximately 60 rows on a page and with columns=2 option turned on, I can get approximately 120 rows per page. I used a very basic version of your code but took out the percent specification for headers because I find it better to not try to overcontrol column widths until I get most of the report the way I want. It was pretty clear from the OP that the existing code did not really work. So I started very basic. Of course, any change in cellpadding or font size is going to change the number of rows and columns that can fit on a page. Also, for options, I prefer to specify my own margins after I specify a papersize. I chose letter because I may want to print this and letter is the size of paper in my printer.

  Here's the code I used to get 2 pages with 2 columns per page:

Cynthia_sas_1-1673567726765.png

I tried with columns=4 as the only change on the ODS RTF statement and with that same font size (8pt) I was able to get all 200 rows on 1 page:

Cynthia_sas_2-1673567857848.png

So, I think that going back to some of the basic ODS RTF options and not trying to use LISTING options and changing your font size should allow you to get either 2 pages or 1 page for your 200 rows.

Cynthia

sah_biostat
Fluorite | Level 6

Thank you so much @Cynthia_sas for your explanation.The output which you are getting is my desired one. But, here I have front page also to display but i don't want column=2 option there and need to print both outputs in the same file.

As of now I am just giving only ods rtf to the both reports if i need to give column=2 option then I need to write another ods rtf statement for my final data but how can I print both outputs in the same file?

Hope you understand my query here.

Cynthia_sas
SAS Super FREQ

Hi:

  I'm not exactly clear what you want. I can do something like this if I have my desired report title or front page in a SAS dataset:

Cynthia_sas_0-1673619967765.png

The first page was created with the columns=1 option and then the second page was created with columns=4, like this:

Cynthia_sas_1-1673620459251.png

Note also that I turned page numbers off for the "title" page and then turned them back on for the page with the 4 columns. I used ODS ESCAPECHAR and the NEWLINE function to insert some extra space into the "title" page.

Cynthia

sah_biostat
Fluorite | Level 6

Hello @Cynthia_sas

 

My issue got resolved by using column option and using ods rtf columns=max statement.

 

Thanks for your help.

 

Sahithi

Reeza
Super User

@sah_biostat wrote:

My query here is,as this is client requirement to see all the values in the one page like these 200 observation should populate side by side in one page.
Is this possible?

What do you mean by side by side?

What happens if you use the COLUMNS option on the ODS RTF statement and don't modify your PROC REPORT? It takes up 3 pages, so now you need to modify the margin sizes and or font sizes and padding to get it to fit on 2 pages. Or depending on the width of the data go to three columns. 

 

ods rtf file='/home/fkhurshed/Demo1/demo.rtf' columns=2;

proc report data=sashelp.cars (obs=200) style(report)={cellpadding=5};;
columns make mpg_highway;
define make/display;
define mpg_highway/ display;
run;

ods rtf close;
sah_biostat
Fluorite | Level 6

Hello @Reeza ,

 

Actually I need to display front page along with this output.As of now I am just giving only one ods rtf statement for both but now i don't want to apply column=2 options in the front page .So, I need to write another ods statement for this. Is this possible to get both ods outputs in the same file??

 

Thanks for your time

ballardw
Super User

@sah_biostat wrote:

Hello @Reeza ,

 

Actually I need to display front page along with this output.As of now I am just giving only one ods rtf statement for both but now i don't want to apply column=2 options in the front page .So, I need to write another ods statement for this. Is this possible to get both ods outputs in the same file??

 

Thanks for your time


Still do not see any example of your complete code. We need to know all of the options that your are currently using for your ODS destination.

What is "front page"? How is that produced? This stuff interacts and without all of the pieces you are making it extremely difficult to understand what you have and what you want for output.

 

You have indicated you have 200 rows of output to place on a single page. But how much space is left after you create "Front page", what ever that may be? Then there gets to be how much space between the "front page" and the 200 lines.

 

sah_biostat
Fluorite | Level 6

@ballardw,

 

Front page is just related to title of the project and basic demographic data in a table.I don't want front page output and final output in a single page.I need output in 2 pages one is front page another is the actual output. So, here space left after creating "Front page" doesn't matter I guess.

 

Please find my code:

options nodate validvarname=any; 
ods rtf file="&out.\&a..rtf";
proc report data=front_page noheader center;
run;
ods escapechar='^';
ods text=" ";
ods text="^S={color=red width=100% just=c}xxxxxxxxxxxxxxx";

options papersize=letter topmargin=.5in rightmargin=.5in leftmargin=.5in
proc report data=final 
style(report)={cellpadding=3px}
style(column)={font_size=8pt};
column order spid;
define order /display "xxxxx to select the xxxxxxxx" STYLE (HEADER) = {JUST=C CELLWIDTH=10%};
define spid /display "xxxxxxxx xxxxxx from the xxxxxxx list of the xxxx" STYLE (HEADER) = {JUST=C CELLWIDTH=10%};
run;
ods rtf close;

Here for getting desired output i need to give column=2 in the ods statement before final dataset's proc repport.If I write the ods statement there I don't get two outputs in the same file.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 5203 views
  • 3 likes
  • 5 in conversation