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

RE: st: identify group of observations


From   Richard Williams <Richard.A.Williams.5@nd.edu>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: identify group of observations
Date   Thu, 29 Apr 2004 07:34:27 -0500

At 01:23 PM 4/29/2004 +0100, Nick Cox wrote:
Good point. However, as we're playing minor improvements,
note this too needs a fix:

gen grp = sum(flag == "01") if flag == ""

or

gen grp = sum(flag == "01") if mi(flag)

or perhaps even

gen grp = sum(flag == "01") if trim(flag) == ""

to catch "missings" that are somehow spaces.

Any more?
According to the original problem, flag is supposes to be coded "01" or "02". Ergo, how about

gen grp = sum(flag == "01") if flag == "01" | flag =="02"

*
* 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/




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