SAS学习笔记

SAS学习笔记:data读数据缺失值

2023-02-23  本文已影响0人  RSP小白之路

data test2;
    infile cards dlm = ",";
    input a $ b  d $ e $ ;
cards;
apple,23,one,Monday,
 , ,two,Tuesday,
 , ,three, Wednesday,
 , ,four, Thursday,
;
run;


data test3;
    set test2;
    if missing(a) then a = "aaaaa";
    if missing(b) then b = 1000;
run;
验证缺失值

data test4;
    infile cards dlm = "," ;
    input a $ b $  d $ e  ;
cards;
one,Monday,apple,23
 two,Tuesday
 three, Wednesday
 four, Thursday
;
run;

data test5;
    infile cards dlm = "," missover ;
    input a $ b $  d $ e  ;
cards;
one,Monday,apple,23
 two,Tuesday
 three, Wednesday
 four, Thursday
;
run;
test5输出

可以看到,缺失值正常的呈现。


data test6;
    infile cards dlm = ","  ;
    input a $ b $  d $ e  ;
cards;
one,Monday,apple,23
 two,Tuesday, , 
 three, Wednesday, , 
 four, Thursday, , 
;
run;
test6输出
上一篇 下一篇

猜你喜欢

热点阅读