The number of non-missing values varies with cases. For example, as shown in the below table, a has two values and d has full five values. I want to know how this (m in the below entropy formula) can be integrated into Stata.
Array

x y z w v
a 2 3 . . .
b 4 5 6 . .
c 2 . . . .
d 4 5 6 7 2

[QUOTE]
gen entropy = 0
foreach v in a b c d e {
replace entropy = entropy + cond(`v' == 0, 0, `v' * ln(1/`v'))
}
sum entropy[
/QUOTE]