West Addison <[email protected]> notes that -egen- does not respect extended
missing values. He writes,
> [...] In Stata version 8, I typed the following command:
>
> by id: egen statefcount = sum(state == .f)
>
> I got, for each id, a count of the number of observations with
> missing values of any sort (. plus .a through .z). [...]
-egen- is not behaving as it should. What -egen- should do is evaluate
expressions involving missing according to the currently specified -version-
level. In West's case, this is -version 8-, and -egen- should be
differentiating extended missing values (.a through .z).
While this could be fixed strictly in the -egen- ado code, a better solution
involves changes to the executable. This will be fixed in the next executable
update.
Given his complete diagnosis of the problem, I am sure that West has already
found a workaround. The easiest is probably to create an indicator variable
then sum on the indicator, transforming West's
. by id: egen statefcount = sum(state == .f)
into
. gen state_is_f = state == .f
. by id: egen statefcount = sum(state_is_f)
-- Vince
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/