【SAS NOTES】ods

复制代码
 1 data mysas.mmsone;
 2     infile 'E:\SAS\mysas\MMS1.txt' dlm='09'x firstobs=2;
 3     input date city $ wangnei wangjian guoji shangxing wangneid wangjiand 
 4             guojid alld allwangnei allwangjian allguoji allall upfeetiao downfeetiao;
 5 run;
 6 proc sort data=mysas.mmsone;
 7     by city;
 8 run;
 9 
10 ods trace on;
11 proc means data=mysas.mmsone;
12     by city;
13     ods select  Means.ByGroup21.Summary;
14 run;
15 ods trace off;
复制代码

1、文本类变量一定要加上$

2、Ods output deliver system 

使用ods trace on +ods trace off来确定输出内容有哪些。用ods select +输出内容 来选中特定的内容输出。

复制代码
 1 ods trace on;
 2 proc tabulate data=mysas.mmsone;
 3     class city date;
 4     var wangnei wangjian;
 5     table city all,date,(wangnei wangjian)*max;
 6     ods output Tabulate.Report.Table=mysas.reportmms;
 7     run;
 8 ods trace off;
 9 proc print data=mysas.reportmms;
10 run;
复制代码

用ods trace确定输出的内容后可以用ods output ***=dataset 来实现将处理结果输出到新数据集。

1 ods html file='E:\SAS\mysas\outputhtml.html';
2 ods noproctitle;
3     proc tabulate data=mysas.mmstwo;
4         class city date;
5         var wangnei wangjian;
6         table city all,date,(wangnei*mean wangjian*min);
7     run;
8 ods html close;

用ods html file +ods noproctitle+ods html close 来将中间圈定的输出用html来展现。

 

1 ods rtf file='E:\SAS\mysas\outputrtf.rtf';
2 ods noproctitle;
3     proc means data=mysas.mmstwo;
4         class city date;
5         var wangnei wangjian;
6         by city;
7     run;
8 ods rtf close;

类似生成html ods 也可以用来生成rtf格式(即word格式)的文件,区别在于将html 换成rtf

 同样原理,ods可以生成pdf pcl ps格式的文档。

复制代码
1 ods rtf file='E:\SAS\mysas\outputrtf.rtf';
2 ods noproctitle;
3     proc means data=mysas.mmstwo;
4         class city date;
5         var wangnei wangjian;
6         by city;
7         title color=green 'this' bcolor=navy 'is' height=1cm 'a' justify=center bold 'title.';
8     run;
9 ods rtf close;
复制代码

对title 和footnotes的字体等控制。

 

1 ods html file='E:\SAS\mysas\style.html';
2 proc print data=mysas.mmstwo
3     style(data)={background=pink};
4     var city wangnei wangjian date;
5     var wangnei/style(data)={font_weight=bold};
6     id city;
7     run;
8 ods html close;

在proc print 和var 中通过加入style(data)or /style(data)={}来实现对背景或某个变量的单独控制。

1 ods pdf file='E:\SAS\mysas\stylepdf1.pdf';
2 proc tabulate data=mysas.mmstwo
3     style={background=silver};
4     class city/style={background=green};
5     var  wangnei wangjian;
6     table city all,(sum*wangnei*all N*wangjian*all*{style={background=white}});
7 run;
8     ods pdf close;

在proc report和proc tabulate 中同样可以使用style={}来改变输出的样式,注意style在report和tabulate中不同位置的写法。class为 /style table为*style{}

 

 

 

posted on   colipso  阅读(1800)  评论(1编辑  收藏  举报

编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
< 2013年1月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2
3 4 5 6 7 8 9

导航

统计

点击右上角即可分享
微信分享提示