Statalist


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

Re: st: summing variables


From   "ricardo sierra" <[email protected]>
To   [email protected]
Subject   Re: st: summing variables
Date   Thu, 26 Jul 2007 16:17:31 -0400

Dear Peggy,

egen totalmg=rowtotal(mg_1-mg_108)

should work.

RS





On 7/26/07, P chrisman <[email protected]> wrote:
Dear List,

I need to find the total mg of a treatment received for each subject. I
have mg of treatment drug as variables mg_1 for the first dose received
through mg_108 for the last dose received. I would normally just create
a variable, e.g. gen totalmg= mg_1 + mg_2 to find the total, but since I
have 108 doses to sum, I am wondering if there is a more efficient way
to create the totalmg?

Thanks,
pc
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index