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

I'm using ODS EXCEL to export results produced by PROC FREQ to Excel. The output includes an empty row between the table title and the start of the table (see highlighted in yellow in Excel file). How can I delete that row in my SAS code? 

 

Do I do this in the PROC TEMPLATE or in the ODS EXCEL statement?

 

Here's my sample code:

*Create sample dataset;
data test;
	set 	sashelp.Class;
	run;

*Create template;
	proc template;
		 edit  base.freq.onewaylist;
			 edit FVariable;                                                       
			 	just=varjust;
				style=rowheader;
				header="Age at survey date";
			end;
		 end;
	run;

ods excel file="PATHNAME\test.xlsx" 
	options(sheet_name="Female" 
			embedded_titles="yes"
			embed_titles_once="yes");

	proc freq data = test(where=(sex="F"));
		tables age;
		title "Age at survey for female participants";
	run;

ods excel close;

proc template;
	delete base.freq.onewaylist;
run;

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Not easily? First you'd have to figure out which parameter/setting controlled that space (top/bottom margin) in the ODS EXCEl, figure out which style you're using and the parent and modify it accordingly.

Here's a rough idea of what that looks like the proc template code at least.
https://support.sas.com/kb/39/540.html

View solution in original post

4 REPLIES 4
Reeza
Super User
Typically done via PROC TEMPLATE but could also be accomplished using HIDDEN_ROWS option and possibly the rowbreaks_interval depending on how dynamic you need it to be.

Zoe8SAS
Fluorite | Level 6

Thanks! I want to delete it, not just hide it. 

How would I do this in PROC TEMPLATE? 

Reeza
Super User
Not easily? First you'd have to figure out which parameter/setting controlled that space (top/bottom margin) in the ODS EXCEl, figure out which style you're using and the parent and modify it accordingly.

Here's a rough idea of what that looks like the proc template code at least.
https://support.sas.com/kb/39/540.html

Zoe8SAS
Fluorite | Level 6

Thanks! I will delete it in Excel for now and then look more closely at the proc template code.

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1286 views
  • 0 likes
  • 2 in conversation