美文网首页Data Science 学习小站
SAS Proc print 选项: by & id 详解

SAS Proc print 选项: by & id 详解

作者: lixin_ggao | 来源:发表于2019-10-12 03:29 被阅读0次

对应 SAS Base 123 题 --Q 93

  • id: 定义输出时标识某一列为obs 观测值标签,可以理解为用某一列的数值代替 1,2,3 (最左侧)的观测标识。
  • by 以某一列group 分组标识
  • var 指明打印的变量,可以存在与id 相同的列,与id 重复则重复输出。
数据集.png

用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;
image.png

by + id

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

相关文章

网友评论

    本文标题:SAS Proc print 选项: by & id 详解

    本文链接:https://www.haomeiwen.com/subject/beyfmctx.html