Statalist


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

st: RE: replacing after egen


From   "Rajesh Tharyan" <R.Tharyan@exeter.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: replacing after egen
Date   Thu, 5 Jul 2007 11:23:29 +0100

Hi,

I believe the command you want is

egen sum=rsum(Alfa Beta)

replace does work after egen!

See this for yourself

***evidence.do***

sysuse auto,clear
keep if make=="Subaru"
list make length turn
egen sum=rsum(length turn)
list make length turn sum
replace length=1 if length>160
list make length turn sum
* of course now you need to do rsum again to make the changes
drop sum
egen sum=rsum(length turn)
list make length turn sum

you CANNOT say replace sum=rsum(length turn)

see more at

http://dss.princeton.edu/online_help/stats_packages/stata/stata_gen.htm

hope this helps
rajesh


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Carlo Lazzaro
Sent: 05 July 2007 10:42
To: statalist@hsphsun2.harvard.edu
Subject: st: replacing after egen



Dear Statalisters,

I beg Your pardon for my trivial thread.

I have calculated via egen the total number of administrations of a given
drugs (Alfa=parenteral; Beta=per os). 

egen Sum=rowtotal(Alfa Beta)

Now I have to amend the data in Alfa, but I notice that replace doesn't work
after egen. Besides, I wasn't able to fin  about this issue seem to arise
from Stata Data Management Manual (egen section).

Any suggestions would be highly appreciated.

Thanks a lot for Your Kindness and for Your Time.

Kind Regards,

Carlo


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

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