SAS--output delivery system--ods html

 ods html body='D:\sas\text.html'; *创建一个text.html,将结果输出到这个文件里,可以创建多个输出,比如pdf等;
proc print data=clinic.admit;
run;                              *默认会弹出HTML和输出(list);
ods html close;           *将ods destination 关闭;


ods listing close;   *将默认输出listing 关闭;
ods listing;         *打开;


ods html file='D:\sas\text1.html';  *创建.html,如果已经创建,则添加在后面,file=body;
ods pdf file='D:\sas\test.pdf';
proc print data=clinic.admit2;
run; 
ods _all_ close;     *对于打开了多个ods destination的话,all全部关闭;
ods listing;

ods  listing close;
ods html file='D:\sas\TEST2.HTML';
proc print data=clinic.admit3;
    var id name sex;
run;
ods html close;
ods listing;

ods listing close;                     *同时输出两个结果;
ods html body='D:\sas\data.html';
proc print data=clinic.admit label;
var id sex age height weight actlevel;
label actlevel='Activity Level';
run;
proc tabulate data=sasuser.stress2;  *制表
var resthr maxhr rechr;
table min mean, resthr maxhr rechr;
run;
ods html close;
ods listing;


ods listing close;                  *为多个结果创建index,查看frame.html;
ods html body='d:\sas\data.html'    
contents='d:\sas\toc.html'          
frame='d:\sas\frame.html';          *html的名字是固定的,且有frame,必须有toc;
proc print data=clinic.admit label;
var id sex age height weight actlevel;
label actlevel='Activity Level';
run;
proc print data=sasuser.stress2;
var id resthr maxhr rechr;
run;
ods html close;
ods listing;


ods listing close;                  *为多个结果创建index/table of contents,查看frame.html;
ods html body='d:\sas\data.html' (url='data.html')
contents='d:\sas\toc.html' (url='toc.html')
frame='d:\sas\frame.html';         *html的名字是固定的,且有frame,必须有toc;
proc print data=clinic.admit label;
var id sex age height weight actlevel;
label actlevel='Activity Level';
run;
proc print data=sasuser.stress2;
var id resthr maxhr rechr;
run;
ods html close;
ods listing;

ods html body='c:\records\data.html'
    (url='http://mysite.com/myreports/data.html')
    contents='c:\records\toc.html'
    (url='http://mysite.com/mycontents/toc.html')
    frame='c:\records\frame.html';


ods listing close;
ods html path='D:\sas' (url=none)      
    body='data.html'
    contents='toc.html'
    frame='frame.html';         *用path省去部分重复;
proc print data=clinic.admit;
run;
ods html close;
ods listing;


ods listing close;
ods html path='D:\sas' (url='http://mysite.com/myreports/')    
    body='data.html'
    contents='toc.html'
    frame='frame.html';        
proc print data=clinic.admit;
run;
ods html close;
ods listing;


ods listing close;
ods html path='D:\sas' (url=none)    
    body='data.html'
    contents='toc.html'
    frame='frame.html'
    style=brick;              *html的风格;
proc print data=clinic.admit;
run;
ods html close;
ods listing;


ods listing close;
ods html path='D:\sas\data' (url=none)    
    body='body.html'
    contents='contents.html'
    frame='frame.html'
    style=brick;              *html的风格,无quotation!;
proc print data=clinic.admit;
run;
ods html close;
ods listing;
ods listing close;
ods html body='E:\sas\data.htm' /*和结果查看器一样*/
            (url='data1.htm')   
        contents='E:\sas\cont.htm'/*创建了output的程序的索引*/
                (url='tab.htm') 
        frame='E:\sas\frame.htm'; *索引和结果一起显示;
    proc print data=sasuser.insure;
        var id name;
    run;
        proc print data=sasuser.admit;
        var id name;
    run;
ods html close;
ods listing;

ods listing close;
ods html  path='E:\sas'
        style= biege   /*结果 右键 模板 sashelp tmplmst style*/
        body='data.htm' /*和结果查看器一样*/
        contents='cont.htm'/*程序的索引*/
        frame='frame.htm'; *索引和结果一起显示;
    proc print data=sasuser.insure;
        var id name;
    run;
        proc print data=sasuser.admit;
        var id name;
    run;
ods html close;
ods listing;