No. And in fact that offers a much cleaner
solution to the
missing if any missing
problem.
gen max = <safe value>
foreach v of local varlist {
replace max = cond(`v' > max, `v', max)
}
Nick
[email protected]
Nick Winter
> Ah yes, I'd forgotten that.
>
> So max(a, b) is NOT the same as cond(a>b,a,b).
> At 05:01 PM 2/18/2005 +0000, you wrote:
> >The second problem is well identified.
> >Thanks.
> >
> >The first problem is no problem.
> >
> >max(42, .) is 42, so initialising to
> >missing is safe.
> >
> >This perhaps surprising feature can
> >be rationalised as follows. Given
> >arguments of
> >
> >-1, 0, 1, 2.71828, 3.14159, 42, .
> >
> >would you really want a -max()- function
> >to return missing? It depends on the problem,
> >but it can be forced the other way:
> >
> >gen max = <safe value>
> >foreach v of local varlist {
> > replace max = cond(`v' == ., ., max(`v', `max')) if !mi(max)
> >}
> >
> >Nick
> >[email protected]
I'd like to add to this by offering some conceptual tools.