Folks, I'm puzzled. Look here:

<hansl>
nulldata 6
set seed 123
series x = uniform()
x[2] = NA
series z = ok(x) && (x < 0.5) ? x : 0
print x z -o
</hansl>

this produces

<output>
              x            z

1    0.2103124    0.2103124
2
3    0.0003299    0.0003299
4    0.5931556        0.000
5    0.9869412        0.000
6    0.6499468        0.000
</output>

Which is IMO wrong. I can see the logic in stipulating that anything 
involving NAs is NA but OTOH I would say that ( 0 && NA ) should be 0.

Note, moreover, that

<hansl>
series z = missing(x) || (x >= 0.5) ? 0 : x
</hansl>

would work the way I'd expect it to.

Am I missing something?

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti(a)univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------

Reply via email to