gen grp = sum(flag == "01") if inlist(flag, "01", "02")
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Richard
> Williams
> Sent: 29 April 2004 13:34
> To: [email protected]
> Subject: RE: st: identify group of observations
>
>
> 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/
>
*
* 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/