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

Re: st: Ritesh's Inquiry


From   Royce Barondes <[email protected]>
To   [email protected]
Subject   Re: st: Ritesh's Inquiry
Date   Sat, 05 Jul 2003 15:36:33 -0500

1. Create a new variable "score_total" (for the entire population or, using "by", the individual community) comprising the sum of all the scores (within the population or community).
2. Generate newvar equal to (score_total-score)/(n-1)

Royce Barondes

At 11:47 AM 7/5/2003 -0700, you wrote:

Dear statalisters,

Lets say i have a list of 10 individuals and 10 scores. For each individual
I would like to compute a new variable that is the average of the other 9
scores. Any ideas on how that can be done?

The data for the example look like this:

id    score    newvar
 1    10
 2    13
 3    12
 4    19
 5    21
 6     9
 .
 .
 .
10    15

The next problem I am having difficulty with is that these 10 individuals
are nested within a community and there are, lets say, 5 communities in
total with 10 individual is each for total N of 50.  I would like to compute
the new variable, where the value for a particular individual is the average
of the scores for the other 9 people in the community where they reside. So
I would like to repeat the procedure separately for each community.

Any help is greatly appreciated,

Ritesh

*
*   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/
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Royce de R. Barondes
Associate Professor of Law
203 Hulston Hall
University of Missouri-Columbia School of Law
Columbia, MO 65211
tel: (573) 882-1109
home: www.legal-environment.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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