楼主: firefox29
6220 11

如何找出存在空值的变量列 [推广有奖]

11
bobguy 发表于 2014-3-14 10:26:37
Yes. It can be done easily. You don't even need to have the variable names in advance.

See example below. All b's are missing of all values.

data t1;
   
   retain b1-b100 .;
   retain a1-a5 1;
   retain c 'c';
   do i=1 to 10;
      output;
        end;
run;

proc means data=t1 noprint;
var _numeric_;
output out=check(drop=_:) nmiss= ;
run;

data _null_;
  if 0 then set t1 nobs=nobs;
  set check;
  array var_names(*) _numeric_;
  do i=1 to dim(var_names);
  if var_names(i)=nobs then do;
     variable_name=vname(var_names(i));
         put "variable_name=" variable_name;
  end;
  end;
run;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
firefox29 + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

12
bobguy 发表于 2014-3-14 10:28:50
bobguy 发表于 2014-3-14 10:26
Yes. It can be done easily. You don't even need to have the variable names in advance.

See exampl ...
If the data set is huge. Then you can run first 10000 or randomly select 10000 obs. The likelihood of All 10000 values being missing is very small.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 19:38