sas ods excel输出多sheet,包含图片、目录等

ods excel可以输出多表格 多图片到一个sheet中,相比较于其他的工具更好用。但是很多人并不知道怎么输出到多个sheet中,以下给出一个搜索到的解决方案。

 转载请注明出处:https://www.cnblogs.com/SSSR/p/11105838.html 

有了此法就可以创建完整的excel报表了。

先直接上代码:修改fbout的值即可运行,

ods escapechar='~';
%let bold_style=~S={font_size=12pt font_weight=bold}~;

ods graphics / height=2.5in width=3.5in;
filename fbout "D:\project\saspro\rtf_excel\test.xlsx";

ods excel file=fbout style=pearl options(embedded_titles="yes" contents="yes");

ods excel options(sheet_interval="none" sheet_name='sheet1' );

ods proclabel= "Detail Report of Males------------sheet1";

title link="#'The Table of Contents'!a1" "Return to TOC";
proc print data=sashelp.class;

run;

/*ods proctitle;*/
ods text="&SYSDATE. Friend Report for";

proc sgplot data=sashelp.class;
scatter x=age y=height;
run;

/*用于输出多sheet,在每次需要生成新的sheet时增加此代码即可。。。*/
ods excel options(sheet_interval='table');
ods select none;
proc means data=sashelp.class ;
var age;
run;
/*用于输出多sheet*/ods select all;


ods excel options(sheet_interval="none" sheet_name='sheet2');

ods proclabel= "Detail Report of Females-------------sheet2";
title link="test.xlsx - 'The Table of Contents'!A1" "Return to TOC";
proc print data=sashelp.class;

run;
ods text="&bold_style.画图";
proc sgplot data=sashelp.class;
scatter x=age y=height;
run;
ods excel close;

效果图:

 sheet1:

sheet2:

猜你喜欢

转载自www.cnblogs.com/SSSR/p/11105838.html
ODS
SAS
今日推荐