On 09/11/12 19:17, Allin Cottrell wrote: > ... The user-function can, however, be written more > tersely -- particularly if we take returning NA as sufficient > indication that the question is invalid: > > function scalar iseven (scalar a) > return a != floor(a) ? NA : a % 2 == 0 > end function Uau !!
But I see that it is not needed an specific function, because for example in an script where you already know it is always produced an integer, you may easily use scalar a = (b % 2==0 ) being a=1 if b is even and a=0 if b is odd ¿no? -- Ignacio Diaz-Emparanza DEPARTAMENTO DE ECONOMÍA APLICADA III (ECONOMETRÍA Y ESTADÍSTICA) UPV/EHU Avda. Lehendakari Aguirre, 83 | 48015 BILBAO T.: +34 946013732 | F.: +34 946013754 www.ehu.es/ignacio.diaz-emparanza/ www.ea3.ehu.es