ods excel

Reply
Occasional Contributor
Posts: 6

ods excel

Hi,

I used following code to export stuff form SAS into excel:

ods excel file="G:\Obesity Studies\AFRI - Data\Reports and across year **bleep**\Form 8 - Phase 3 and 4\ID_Phase_F8.xlsx"
style=pearl;
ods escapechar='~';
ods text="~S={font_size=14pt font_weight=bold}~Summary of ID and Corresponding Phase";
proc print data=Phase_count_F8; quit;
ods excel close;

The font of the main table, not the title is only 8 which is too small for my boss to read. How can I change the fond into 10 in the code? what other options of style can I have and where to get them? Thanks in advance!

 

Xiaoyan Zhu

Super User
Super User
Posts: 7,727

Re: ods excel

Use proc report an put your styling in there:

ods excel file="xyz.xlsx" style=pearl;
proc report data=phse_count_f8;
  columns a b c;
  define a / "Column heading a" style(column)={just=l ...};
  define b / "Column heading b" style(column)={just=l ...};
  define c / "Column heading c" style(column)={just=l ...};
run;
ods excel close;

I wouldn't use ods text - it doesn't work as you expect it to.  Use titles and footnotes.  Here is a paper showing some of the styling you can use:

https://support.sas.com/resources/papers/stylesinprocs.pdf

Super Contributor
Posts: 394

Re: ods excel

Here's an example of creating a custom style based on Pearl but the size of the font used for table elements is 12pt.

ods path (prepend) work.templat(update);
proc template;
	define style styles.bigfont;
		parent = styles.pearl;
		class data /
			fontsize = 12pt;
	end;
run;
ods excel file="test.xlsx" style=styles.bigfont;
proc print data=sashelp.class;
run;
ods excel close;

If you want to change the font size for everything (table cells, titles, etc.) use class container instead of class data.

 

Creating a custom style is a good solution when you want to change the appearance of all your output, including such things as titles and footnotes, BY lines, etc.

 

You can also change the style of just PROC PRINT output using the STYLE= option on the proc statement. You can make fine-grained changes to the style of individual elements (such as ID and VAR columns) in PROC PRINT output as well. Here is the doc for the STYLE= option for PROC PRINT.

 

 

Here is a good tutorial on using styles with the Base reporting procedures (PRINT, REPORT, TABULATE).

Here is the reference doc for ODS style attributes.

 

There are many papers in the SGF proceedings on support.sas.com.

Occasional Contributor
Posts: 6

Re: ods excel

Thank you all.

Ask a Question
Discussion stats
  • 3 replies
  • 377 views
  • 1 like
  • 3 in conversation