SAS输出结果三种保存形式-保存为Word、PDF、HTML
(2013-07-04 15:55:01)分类: 03SAS数据处理 |
SAS对各类过程的分析结果和数据集合的输出可以说基本做到了常用文件格式都能满足。如HTML、pdf、dat、csv、txt、rtf等文件格式。
1.file与put语句组合应用输出控制方式。
2.printto过程输出方式。
3.ODS输出方式,SAS从版本7开始支持ODS输出定制文件格式,可以根据需求输出到不同的存储路径和文件格式。ODS 输出方式可以支持输出的文件格式如下 :PDF、HTML、RTF、CSV和输出到打印机等格式。通过对ODS参数和路径FILE或PATH的设置可以把文件存储到目录。参数的设置可以通过修改参数来观测输出文件的变化,全局变量ODS控制 输出,是SAS的输出亮点。
保存为Word文件:
data a;
input x y@@;
cards;
1 2
3 4
3 5
6 7
;
run;
options nodate nonumber;
ods rtf file='d:\name.doc';
proc reg data=a;
model y=x;
run;
ods rtf close;
保存为PDF文件:
data a;
input x y@@;
cards;
1 2
3 4
3 5
6 7
;
run;
ods printer pdf file ='odsprinter.pdf';
proc reg data=a;
model y = x;
run;
ods printer close;
保存为HTML文件:
ods html file ='d:\new.html';
proc means data=sasuser.score;
var math;
title '数学成绩';
run;
ods html close;
1.file与put语句组合应用输出控制方式。
2.printto过程输出方式。
3.ODS输出方式,SAS从版本7开始支持ODS输出定制文件格式,可以根据需求输出到不同的存储路径和文件格式。ODS 输出方式可以支持输出的文件格式如下 :PDF、HTML、RTF、CSV和输出到打印机等格式。通过对ODS参数和路径FILE或PATH的设置可以把文件存储到目录。参数的设置可以通过修改参数来观测输出文件的变化,全局变量ODS控制 输出,是SAS的输出亮点。
保存为Word文件:
data a;
input x y@@;
cards;
1 2
3 4
3 5
6 7
;
run;
options nodate nonumber;
ods rtf file='d:\name.doc';
proc reg data=a;
model y=x;
run;
ods rtf close;
保存为PDF文件:
data a;
input x y@@;
cards;
1 2
3 4
3 5
6 7
;
run;
ods printer pdf file ='odsprinter.pdf';
proc reg data=a;
run;
ods printer close;
保存为HTML文件:
ods html file ='d:\new.html';
proc means data=sasuser.score;
var math;
title '数学成绩';
run;
ods html close;
后一篇:账号