SAS Proc print 选项: by & id 详解
2019-10-12 本文已影响0人
lixin_ggao
对应 SAS Base 123 题 --Q 93
- id: 定义输出时标识某一列为obs 观测值标签,可以理解为用某一列的数值代替 1,2,3 (最左侧)的观测标识。
- by 以某一列group 分组标识
- var 指明打印的变量,可以存在与id 相同的列,与id 重复则重复输出。

用id , by ,id+by 做个实验:
id:
proc print data = test_db.repotest1 ;
id x;
var y z1 ;
run;
-
output 结果
image.png
by:
proc print data = test_db.repotest1 ;
by x;
var x y z1 ;
run;

by + id
proc print data = test_db.repotest1 ;
by x;
id x;
var y z1 ;
run;
