Syntax, ODS EXCEL statement:
ODS EXCEL <(<ID=>identifier)> <action>;
ODS EXCEL <(<ID=>identifier)> <option(s)>;
|
ods excel file="multitablefinal.xlsx"
options(sheet_interval="bygroup"
suppress_bylines="yes"
sheet_label="country"
embedded_titles="yes"
embed_titles_once="yes" );
title "Historical Sales Data";
proc tabulate data=sashelp.prdsale;
by country;
var predict actual;
class region division prodtype year;
table year=[label=' '],
region*(division*prodtype all=[label='division total'])
all=[label='grand total'],
predict=[label='total predicted sales']*f=dollar10.*sum=[label='']
actual=[label='total actual sales']*f=dollar10.*sum=[label=''] /
box=_page_;
run;
ods excel close;
ods html close; data prdsale; set sashelp.prdsale; Difference = actual-predict; run; proc sort data=prdsale; by country region division year; run; ods excel file='tagattr.xlsx'; proc print data=prdsale(obs=15) noobs label split='*'; id country region division; var prodtype product quarter month year; var predict actual / style={tagattr='format:$#,##0_);[Red]($#,##0)'}; var difference / style={tagattr='format:$#,##0_);[Red]($#,##0) formula:RC[-1]-RC[-2]'}; sum predict actual difference / style={tagattr='format:$#,##0_);[Red]($#,##0)'}; label prodtype = 'Product*Type' predict = 'Predicted*Sales*For Area' actual = 'Actual*Sales*Amount'; run; ods excel close; ods html path="%qsysfunc(pathname(work))";
#Expense .header { background-color:green } #Reports .header { background-color:red }
ods html close; ods excel file="c:excelAnchorCss.xlsx" cssstyle="file-pathStylesheet.css" options(sheet_interval="none"); ods excel anchor="expense"; proc print data=sashelp.class; run; ods excel anchor="reports" cssstyle="file-pathStylesheet.css"; proc print data=sashelp.class; run; ods excel close; ods html path="%qsysfunc(pathname(work))";