Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Replace value for some observation with average values of some other observations?


From   Stata Chris <[email protected]>
To   [email protected]
Subject   st: Replace value for some observation with average values of some other observations?
Date   Wed, 18 Jan 2012 13:16:20 +0100

Dear list members,

Suppose I have a dataset with variables id and outcome.
Now for the observation with id=1 I want to replace the value of the
outcome by the average outcome values of the observations with id=2
and id=3.

I thought of

replace outcome=mean(outcome[id==2],outcome[id==3]), but this does not
quite work.

Would anyone know how to do this correctly?

Thank you so much,
C
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index