全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3928 4
2014-03-16
求大神指点,如何计算数据集中每行元素非缺失个数,非零个数
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-3-16 10:27:23
num=n(of _numeric_);
n函数是求非缺失值个数,非0个数我就不知道了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-3-16 23:08:55
Try to use NMISS function based on SAS version 9.2 :)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-3-17 02:24:14
data have;
infile cards dsd truncover dlm=' ';
input x1-x5 ;
cards;
1 2 0  40
1  9 0 0
8  5  9
7 50 5 7 3
;
run;

data want;
  set have;
  array x _numeric_;
  n=n(of x(*));
  nmiss=nmiss(of x(*));
  nonezero_1=countw(catx(' ', of x(*)),' 0');
  nonezero_2=countw(catx(' ', of x(*)),'. 0');
  run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-10 16:14:58
nonezero_1=countw(catx(' ', of x(*)),' 0');
  nonezero_2=countw(catx(' ', of x(*)),'. 0');
这个地方能解释一下吗
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群