****missing()函数是用来检验缺失值的函数;
/*举例如下*/
data example;
input x1 x2;
if missing(x2) then delete;
cards;
1 2
. 9
3 .
6 .n
;
run;
proc print;
run;
***反思警示***;
*我们经常遇到需要剔除缺失值(当需要把字符型数据也剔除时)的情况,通常习惯用'if variable=. then delete'语句,但是这个语句在很多情况下容易出错,剔除不了字符型数据*;
*举例如下*;
/*
data example;
input x1 x2;
if x2=. then delete;
cards;
1 2
. 9
3 .
6 .n
;
run;
proc print ;
run;
if x2=. then delete这样的结果只会剔除缺失的值,而字符则删除不了,得到以下结果:
SAS 系统 2013年10月20日 星期日 下午11时03分17秒 6
Obs x1 x2
1 1 2
2 . 9
3 6 N
如果需要剔除.n,我们可以考虑missing()函数 ,感觉用missing()函数更加保险,嘿嘿、、、、、
*/