user7677227
user7677227

Reputation:

SAS: Proc Export to Excel with layout?

My first post here with a question. Hope I do this "in the right way". I've build a query in SAS (mainly PROC SQL) which is generating a monthly report, based on certain criteria.

I'm exporting the tables I create to an Excel-file using Proc Export. This is the line of code I use:

proc export data=work.par_reg
  outfile="&myfilerfp." 
  dbms=xlsx
  replace;
  sheet="Particulieren regulier";
run;

I have more tabs in this file but the Excel that's being created, is only text / numbers without any lay-out. Is it possible to either apply some kind of lay-out to this Excel (like white background, yellow titles, etc) or is it possible to export into an existing template sheet which already has a lay-out?

Thanks for the help!

Upvotes: 0

Views: 5892

Answers (1)

Joe
Joe

Reputation: 63434

PROC EXPORT is only intended for what you see - getting values onto the sheet.

If you want styling, then you have a few choices, but your best option is ODS EXCEL, available in SAS 9.4 TS1M1 or later. You can see some tips on using it from Chris Hemedinger here or read the documentation here.

The simple usage though is like this:

ods excel file="c:\blah\whatever\myfile.xlsx" style=[your style];

proc print data=your_dataset;
run;

ods excel close;

You can use PROC TEMPLATE to define the style options (colors, backgrounds, fonts, whatnot) or create a style using CSS and use cssstyle= if you know CSS.

Upvotes: 0

Related Questions