Statalist


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

st: replacing values in a variable with rowsums, aka "ereplace"


From   "oreuter@emory.edu" <oreuter@emory.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: replacing values in a variable with rowsums, aka "ereplace"
Date   Mon, 14 Jul 2008 07:16:46 -0700

Dear Statlisters,

I am searching for something that would do the equivalent of an
'ereplace'.  I have a set variables for which I generated a -rowtotal-
given some condition, e.g. (egen x=rowtotal (d1-d40) if y=1), but then
I need to replace some values in that same variable (x) with a
different -rowtotal- given a different condition.  I dont know how else
to explain it except to say that if there were an  'ereplace' command
the next command would look like this:

"ereplace" x=rowtotal(d2-d40) if y=2

In other words, I need to replace values in x with different sums of
variables.  I need to do this for a great many conditions so typing out
the list of variables to be added for each condition would be a minor
pain.


  Ora John Reuter
Emory University
Department of Political Science
327 Tarbutton Hall
1555 Dickey Drive
Atlanta, GA 30322
Phone(Atlanta)-1-931-312-9132
&#1058;&#1077;&#1083;&#1077;&#1092;&#1086;&#1085;
(&#1055;&#1077;&#1088;&#1084;&#1100;)-+89197154869


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

Privileged, confidential or patient identifiable information may be contained in this message. This information is meant only for the use of the intended recipients. If you are not the intended recipient, or if the message has been addressed to you in error, do not read, disclose, reproduce, distribute, disseminate or otherwise use this transmission. Instead, please notify the sender by reply e-mail, and then destroy all copies of the message and any attachments.


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