【发布时间】:2017-08-06 08:59:26
【问题描述】:
data tt;
input init $ ht wt sex $ time @@;
if ht=. then short=' ';
else if ht<170 then short='y';
else short='n';
if wt=. then heavy=' ';
else if wt<80 then heavy='y';
else wt='n';
cards;
qqq 160.4 60.3 m 1 ewe 167.4 81.5 f 3 aqw 168.0 79.34 f 6
ccc 181.4 87.7 m 19
;run;
proc print data=tt;
run;
output s like this
init ht wt sex time short heavy
qqq 160.4 60.3 m 1 y y
ewe 167.4 . f 3 y
aqw 168.0 79.34 f 6 y y
ccc 181.4 . m 19 y`
我不知道为什么wt 缺少值。当我把if wt>80
然后wt(60.3 and 79.34) 将丢失,81.5 和87.7 将显示在输出中。
【问题讨论】:
-
我认为你的最后一行也应该显示“n”代表“short”。我不知道用什么语言来回答,但指出这一点,因为您似乎忽略了这一点。
标签: if-statement sas missing-data