dimanche 6 août 2017

missing output values with diferent if condition for a particular variable

   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`

i dont know why 'wt' is having missing values. When i put ' if wt>80 ' then wt(60.3 and 79.34) will be missing and 81.5 and 87.7 will show in the output.

Aucun commentaire:

Enregistrer un commentaire