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

st: RE: Re: count


From   "Steichen, Thomas J." <SteichT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: count
Date   Wed, 11 Jan 2006 10:47:55 -0500

victor michael zammit writes:
> In version 8 ,how do you get to count the number of P's and 
> A's for each Name
> 
> Hello Stata listers,
> In version 8 ,how do you get to count the number of P's and 
> A's for each Name
> 
> 
>   Name D8  D9  D14  D15  D16  D19
> 1.  Z      A    A    P      P       P     A
> 2. G       P     A    P      P      A     P
> 3. S       A      P    P      P      A    A
> 4. An    A       P    P     A       P    P
> 5. Ma    P       P    P      P     A     P

The egenmore function -rcount- would do this:

  . egen countA = rcount(D8 D9 D14 D15 D16 D19) , c(@ == A) 
  . egen countP = rcount(D8 D9 D14 D15 D16 D19) , c(@ == P)

This generates variables whose values are the counts of A's and P's in each observation.
There may be an updated way to to this too...

tom  

-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.


*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index