Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Missing values in -egen-

From   West Addison <>
Subject   st: Missing values in -egen-
Date   Mon, 13 Sep 2004 20:31:13 -0700 (PDT)

I have noticed what seems to be a rather unfortunate
feature of -egen-.  In Stata version 8, I typed the
following command:

by id: egen statefcount = sum(state == .f)

expecting to get, for each id, a count of the number
of observations with state == .f.  Unfortunately,
because version is set to less than 8 in egen.ado, I
got, for each id, a count of the number of
observations with missing values of any sort (. plus
.a through .z).  (See Stata 8 User's Guide, p. 116.)

This will no doubt surprise many users--the user has
to know which version of Stata -egen- is written in to
know how it will behave.  Furthermore, it means that
-egen- does not work in a way paralled to -generate-;

by id: generate statefcount = sum(state == .f)

counts only the .f's.  Moreover, if -egen- is ever
updated to version 8, its behavior will change (or it
will have to be made to artificially conform to
strange way it works now).

West Addison

Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index