BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AdrianGriffin
Obsidian | Level 7

I often need to do wide tables to see a lot of data at a glance.  But when using proc report, the report does not pack as many columns on the page as it could.  See attached output.

Is there any way of using all the available space?  The system recognizes the full width of the paper--the page number on the top line is just where it should be.

--Adrian

*””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””;

*Generate data;

*””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””;

proc sql;

  create table cars as select distinct make, model from sashelp.cars;

quit;

data forecast;

  set cars(obs=80);

  do Year=1990 to 2050;

    sales=year+5000*ranuni(7); output;

  end;

  format sales comma8.;

run;

*””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””;

*set up style based on htmlblue;

*””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””;

proc template;

  define style styles.blackpdf;    *Style suitable for pdf output;

  parent=styles.htmlblue;

  style body/backgroundcolor=white;

  style systemtitle/font_face='Gill Sans MT' font_size=11pt font_weight=medium;

  style systemfooter/font_face='Gill Sans MT' font_weight=medium font_size=11pt;

 

  style pageno/font_face='Gill Sans MT' font_size=10pt;

  style proctitle/font_face='Gill Sans MT' font_size=10pt;

  style byline/font_face='Gill Sans MT' font_size=10pt;

  style notecontent/font_face='Gill Sans MT' font_size=10pt cellheight=18pt;

  style table/cellspacing=0 backgroundcolor=white;

  style header/font_weight=medium font_face='Gill Sans MT' paddingleft=1pt paddingright=1pt paddingtop=4pt paddingbottom=4pt

               font_size=9pt verticalalign=middle bordertopwidth=1.5 bordertopcolor=black

               borderbottomwidth=0.25 borderbottomcolor=black;

  style rowheader/font_weight=medium font_face='Gill Sans MT' paddingleft=3pt paddingright=3pt paddingtop=2pt paddingbottom=2pt

                  frame=void font_size=8pt;

  style data/font_face='Gill Sans MT' paddingleft=1pt paddingright=1pt paddingtop=1pt paddingbottom=2pt font_size=8pt;

  style notecontent/frame=void verticalalign=middle;

  end;

run;

*””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””;

*Do report;

*””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””;

options pageno=1 papersize=tabloid orientation=landscape;

options sysprintfont=('SAS Monospace' 7);

ods listing close;

ods pdf file="&desktop.wideoutput.pdf" style=blackpdf;

ods escapechar='^';

proc report nofs data=forecast;

  columns (make model year, sales);

  define make/group noprint;

  define model/group style=[width=1.7in] ' ' id;

  define year/across ' ' style=[fontsize=8pt width=0.35in];

  define sales/format=comma8. style=[width=0.35in] ' ';

 

  compute before make/style=[fontsize=10pt];

     line @1 make $40.;

  endcomp;

  title1 'Test of wide output';

run;

title2;

ods pdf close; ods listing;

options papersize=letter orientation=portrait;

1 ACCEPTED SOLUTION

Accepted Solutions
AdrianGriffin
Obsidian | Level 7

Technical support confirmed that this is a known defect in SAS that will be addressed in a future release.  It also seems to affect the RTF destination.

View solution in original post

6 REPLIES 6
ballardw
Super User

Have you tried using the UNIFORM option on the ODS PDF statement? It might make the pages more similar. The cause is that the width of the paper is exceeded for the row categories and they are continued on the following page but with fewer columns as the data runs out. So the second page isn't as wide as the first.

You might be better off with HTML or Excel as either of those would prevent the wrapping to next page, though actual print will still be a problem due to paper size limits.

AdrianGriffin
Obsidian | Level 7

The issue is that it doesn't use all of the available width on the first page before starting a new physical page. A printer-type destination is what I need. I want a multiple-page report with the id row heads repeated that I can print and take to a meeting. 

Uniform has no effect.

ballardw
Super User

Then you are probably looking at margin issues. Either the system options of leftmargin and rightmargin or possibly the Marginleft and Marginright style attributes in the style used. But I'm not sure of how many places you'll need it.

Cynthia_sas
SAS Super FREQ

Hi:

  I think the issue that you're running into is that for your output, you have 1990-2025 on page 1 and then 2026-2050 on page 2. You have the same number of ROWS on page 1 and page 2, but different number of COLUMNS. Page 2 does not need the full width to display the years from 2026-2050. At most, it could only squeeze a few more years on page 1. You have papersize set to tabloid but do NOT specify margin options. I don't know what the default margins are -- but your output will only stretch from margin to margin if you specify that it needs to. If I take the width= style attribute out of the PROC REPORT code and explictily set margins to .1in all around, I can get more years onto the report (up to 2029) -- but the results still do not span from margin to margin. My guess is that there is an internal PDF routine that takes over when PDF realizes that your output is too wide to fit on the tabloid page no matter what the margins are -- and then the paneling algorithm takes over and tries to make your output "look balanced" when the panels break across pages.

  My guess is that you really need to work with Tech Support on this. Usually, with PDF and PROC REPORT, if you want to FORCE a panel to spill over to another page, you use the PAGE option on the variable that should start the new panel. See code below. But since you have an ACROSS usage for YEAR/SALES, you don't have the ability to force the panel to start at a certain year. Notice how for BMW, the Cylinders variable starts a new panel because of the PAGE option and then the Make and Type variables are repeated on page 2 because of the ID option.

cynthia

** Only get a subseet of data;
proc sort data=sashelp.cars out=cars;
by  make type model;
where make in ('BMW', 'Lexus', 'Mazda', 'Jaguar', 'Suburu','Volvo');
run;

 

ods _all_ close;
** explicit paneling;
options orientation=portrait papersize=letter topmargin=.25in bottommargin=.25in leftmargin=.25in rightmargin=.25in number;
ods pdf file='c:\temp\explicit_panel.pdf' style=printer;
   
proc report data= cars nowd spanrows
     style(report)={width=100%};
title '1) Explicit Paneling';
column Make Type Model Origin DriveTrain MSRP Invoice EngineSize Cylinders
       Horsepower MPG_City MPG_Highway Weight Wheelbase Length;
define make / order id;
define type / order id;
define Cylinders /  page;
break after make/page ;
run;
ods _all_ close;
title; footnote;


explicit_panel_report.pngup_to_yr_2029.png
AdrianGriffin
Obsidian | Level 7

Thanks. I suspected that ods was slightly overestimating the column width and then underestimating the number that would fit on a page. Might be one for the developers. I'll send it in to tech support.

AdrianGriffin
Obsidian | Level 7

Technical support confirmed that this is a known defect in SAS that will be addressed in a future release.  It also seems to affect the RTF destination.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 5761 views
  • 3 likes
  • 3 in conversation