首页 技术 正文
技术 2022年11月6日
0 收藏 307 点赞 768 浏览 1436 个字

SAS进阶《深入分析SAS》之数据汇总和展现

1. 通过Print过程制作报表

proc print <data=数据集>;
run;
选项:
obs=修改观测序号列标签
noobs不显示观测序列号
id语句在输出中取代观测序列
var选择输出的变量
where语句选择输出的观测总结如下:
proc print data=数据集<选项>;
id 变量1<变量2...>;
var 变量1<变量2...>;
where 表达式;
sum 变量1 <变量2...>;
where 表达式;
sum 变量1<变量2...>;
sumby 变量1<变量2...>;
run;

2. tabulate

proc tabulate data=Saslib.Sales2;
title1 'Sales in North America';
title2 'TOtal Transactions';
/*
*class为分类变量
*/
class Emp_ID Dept;
var Sales;
table Dept*Emp_ID,Sales;
run;

3. 通过GPLOT过程制作图行

分组变量

    axis1 order=(18900 to 18960 by 5);
axis2 order=(9000 to 20000 by 1000);
minor=(color=blue height=0.25 number=1);
symbol value=# cv=red
interpol=join ci=blue;
proc gplot data = Saslib.Sales;
title f = 'Albany Amt' c = blue h = 3 u = 2 'Yearly Amount in North America';
footnote j = r 'Optimization Solution Co.Ltd';
plot Sales*Date=Emp_ID/haxis=axis1 vaxis=axis2;
run;
quit;
goptions reset=all;

4. 增强型HTLM输出

    proc sort data=sashelp.prdsale out=work.prdsale;
by country;
run;
ods html path="C:\Users\LEI\Desktop\data"
body='prdsalebody.html'
frame='prdsaleframe.html'
contents='prdsalecontents.html'; proc tabulate data=work.prdsale;
class region division prodtype;
var actual;keyword all sum;
keylabel all='Total';
table (region all)*(division all),
(prodtype all)*(actual*f=dollar10.) / misstext=[label='Missing']
box=[label='Region by Division and Type'];
run; ods select ExtremeObs Quantiles Moments;
proc univariate data=work.prdsale;
by Country;
var actual;
run; ods html close;

总结:SAS对数据的汇总和表现两种方式:一种是列表,一种是图行。通过print和tabulate过程制作各种报表和汇总报表;GPLOT过程和GCHART过制作散点图、连线图、气泡图、柱状图等多种图行;ODS输出传送系统,包括如何选择或挑剔输出对象,创建多种格式的输出文件。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,999
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,511
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,357
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,140
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,770
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,848