BookmarkSubscribeRSS Feed
nnl3256
Obsidian | Level 7

I have a table that contains more than 2400 rows of records. After ods converting to a excel file, when using print preview or printing a hard copy, the footers overlay on the last row of the page. What ods excel option can be used to set number of rows on a page to avoid overlay?

ods listing close;
	ods excel  file="C:\temp\try.xlsx" style=snow;			
	options
	(
		sheet_name = "ID and File Name" 
		absolute_column_width="10, 50"  
		autofilter="all"	 
		row_repeat="1" 
		frozen_rowheaders='yes' 
		frozen_headers='yes'
		fittopage='no'
		embedded_footnotes='yes'
		print_footer="&L&A &CPage &P of &N &R%sysfunc(today(), mmddyy10)"
	);    

	title;
	proc print data=pdflist noobs;
		var HCO_ID /style(column)=[just=right];
		varFileName /style(column)=[just=left];
	run;
	
ods excel close;
ods listing;

example.gif

4 REPLIES 4
SuzanneDorinski
Lapis Lazuli | Level 10

I used the code you provided with the dataset you provided.  I didn't see the same problem in Print Preview.

 

In the screen shot below, the top and bottom margins in my spreadsheet look different than in your screen shot.

 

Footer in PRINT PREVIEW is not covering up last row of detail on the first pageFooter in PRINT PREVIEW is not covering up last row of detail on the first page

Page Setup in my spreadsheet shows a top margin of 0.5 and a bottom margin of 05. 

 

Page Setup in your spreadsheet shows a top margin of 0 and a bottom margin of 0. 

 

I'm not sure how to fix the issue.

nnl3256
Obsidian | Level 7

Thank you for testing. I find out that the problem appears randomly by using the same code on different dataset. I may try to set orientation and margin to override the default setting.  Thanks again.

SuzanneDorinski
Lapis Lazuli | Level 10

Perhaps @Chevell_sas or somebody else at SAS will chime in with suggestions.

xxformat_com
Barite | Level 11

Hi,

 

Here both values are expressed in inches. Centimeters can be used by bottommargin= global option but not by print_footer_margin=.

 

 

options bottommargin=1in;
      
ods excel file="&xxtest./reporting/demo.xlsx";

ods excel options(print_footer='This is a demo'
                  print_footer_margin='.5');

proc print data=sashelp.cars noobs;
run;

ods excel close;

 

 

Page Setup - On my computers values are displayed in centimeters but it depends on the language used on your computer.

1inch=2,54 centimers.

 

xxformat_sas_training_ods_excel_margin.JPG

 

Result

xxformat_sas_training_ods_excel.JPG

 

Alternative syntax using a style template.

 

proc template;
    define style styles.xxdemo;
    parent=styles.excel;
    class body /
        marginbottom = 1in;
    end;
run;

      
ods excel file="&xxtest./reporting/demo2.xlsx" style=xxdemo;

ods excel options(print_footer='This is a demo'
                  print_footer_margin='.5');

proc print data=sashelp.cars noobs;
run;

ods excel close;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 1514 views
  • 0 likes
  • 3 in conversation