Statalist The Stata Listserver


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

st: Summing variables over all observations by identifier


From   "Amber Katz" <[email protected]>
To   statalist <[email protected]>
Subject   st: Summing variables over all observations by identifier
Date   Tue, 9 May 2006 13:59:13 -0400

Hi,

I'm looking for a function that will sum a variable across all
observations by identifier.

For example, if I have

ID  A
1   1
1   0
2   1
2   2

I would like a function that would give me:
SumByID=function(A,ID)

SumbyID would be equal to 1 for all observations with ID=1 and 3 for
all observations with ID=2 .

Thanks very much,
Rachel

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