全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
3497 8
2013-01-18

方法一:(利用数组求缺失值)

data quan(keep= k);

set quan.cydc;

array x _numeric_;

  do i=1 to dim(x);

   if x(i)=. then j+1;

   end;

   if _n_>1 then k=dif1(j);

   run;

proc print data=quan;

run;

方法二:(转置方法用过程步求缺失值)

proc transpose data=quan.BAIPU out=quan;

var X1-X10;

run;

proc means data=quan nmiss;

  var COL1-COL10;

  output out=quan1nmiss=miss1;

  run;

方法三:(转置后用sql求缺失值)

proc transpose data=quan.BAIPU out=quan;

var X1-X10;

run;

proc sql;

  select nmiss(col1)as miss1,nmiss(col2)asmiss2

  from quan;

  quit;


这些都是比较简单的程序,希望大牛们跟帖高级程序。


二维码

扫码加我 拉你入群

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

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

全部回复
2013-1-19 00:32:26
how about using functions (NMISS & CMISS) directly?
二维码

扫码加我 拉你入群

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

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

2013-1-19 07:54:20
It is always better to use existing SAS functions. See  the example below

data t1;
    array p(*) p1-p10;
   do i=1 to 5;
      do j=1 to dim(p);
            if ranuni(123)>=0.5 then p(j)=.;
                else p(j)=1;
          end;
        output;
        end;
        drop i j;
run;

data t2;
  set t1;
  array x _numeric_;
  n_miss=nmiss(of x(*));
run;

proc print;run;
二维码

扫码加我 拉你入群

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

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

2013-1-19 09:09:53
bobguy 发表于 2013-1-19 07:54
It is always better to use existing SAS functions. See  the example below

data t1;
表示长见识了
二维码

扫码加我 拉你入群

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

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

2013-1-19 11:21:34
Contrast to traditional way to delete missing values in the model, some procedures in sas start a new algorithm called Full Information Maximum Likelihood to take advantage of residual information after missing. in this case, sas will describe how the missing values are distributed in the data, which is much more advanced than we do it manually as above. for examples, the SEM model in SAS.
JingJu
二维码

扫码加我 拉你入群

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

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

2013-1-21 09:35:24
学习了
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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