Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Counting interactions within a group


From   "Steichen, Thomas J." <SteichT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Counting interactions within a group
Date   Mon, 26 Nov 2007 14:08:10 -0500

bysort x y : gen z =_N

-----------------------------------
Thomas J. Steichen
steicht@rjrt.com
-----------------------------------
 
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of mai mai
Sent: Monday, November 26, 2007 2:04 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: Counting interactions within a group

Hi,
I have the following data, I want to count the number of times x
interacts with a specific y within each id, I want to create z:
id    x    y   z
s     1    1   1
s     1    3   2
s     1    3   2
s     1    4   1
s     2   1    2
s     2   1    2
s     2   3    1
s     2   4    1
f     1    1    1
f     1    2    2
f    1    2     2
f..........


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

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