Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Replacing observations with values from other observations


From   Rebecca Pope <rebecca.a.pope@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Replacing observations with values from other observations
Date   Fri, 31 May 2013 15:38:29 -0500

Moses,
Do you mean you want to replace the value of var1 with the value of
some other variable based on obsID? If so, it is just:

replace var1 = var2 if obsID==5

Or, are you wanting to replace var1 for obsID==5 with a different
value of var1 that is observed for a different ID or some other
condition? An example dataset & end result would be really helpful.

Regards,
Rebecca

On Fri, May 31, 2013 at 3:31 PM, Pounds, Moses A.
<MAPounds@bcps.k12.md.us> wrote:
> Hello everyone,
>
> I would like to replace specific observations with values from other observations. I can use
>
> replace var1 = 500 if obsID==5
>
> to replace the value for variable 1 in the observation with ID number 5, with the quantity 500. What I would like is code that allows me to make a reference to another observation, in place of that "500." Does anyone have a way to do this? (My option of last resort is to do this in Excel, but I would prefer to keep working in Stata.)
>
> Thanks in advance for any help you can give,
> Moses
>
> ----------------------------------------
> Moses A. Pounds
> Program Evaluator
> Baltimore City Public Schools
> Office of Achievement and Accountability
>
> NOTICE: The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained herein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index