全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
4018 2
2010-02-28
The function cmiss can be used to subset a data set by excluding missing values.

Here is an example.


data t1;
length      n1   n2  8  c1  c2 $1;
infile cards truncover;
  input  n1    n2   c1  c2 ;
  do i = 1 to 1000;
  output;
  end;
  drop i;
  cards;
  1 2 a b
  . .  
  3 . c d
  ;

/*  proc print; run;*/

  ****if all variables have missing then delete***;
data t2;
     set t1;
     if cmiss(of _all_) <4  ;
run;

****log***
473  data t1;
474  length   n1   n2  8  c1  c2 $1;
475  infile cards truncover;
476    input  n1    n2   c1  c2 ;
477    do i = 1 to 1000;
478    output;
479    end;
480    drop i;
481    cards;

NOTE: The data set WORK.T1 has 3000 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.01 seconds


485    ;
486
487  /*  proc print; run;*/
488
489    ****if all variables have missing then delete***;
490   data t2;
491       set t1;
492       if cmiss(of _all_) <4  ;
493  run;

NOTE: There were 3000 observations read from the data set WORK.T1.
NOTE: The data set WORK.T2 has 2000 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
二维码

扫码加我 拉你入群

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

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

全部回复
2010-2-28 01:24:35
This  is the first time I saw cmiss function, thanks
二维码

扫码加我 拉你入群

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

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

2010-2-28 13:38:37
thank you for sharing the function of cmiss which can eliminate the missing value
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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