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:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM