Statalist


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

Re: st: RE: summing variables


From   "ricardo sierra" <ricardo.sierra@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: summing variables
Date   Thu, 26 Jul 2007 18:35:44 -0400

I completely agree in that we have to be careful with missing data.
Using Martin's and Joseph's approach makes subjects that didn't
receive one dose of the drug will be accounted as missing in the total
mg variable. The "rowtotal approach" would give Peggy the mg sum for
the doses subjects had, not caring if they didn't take the whole 108
doses. So the correct approach depends on the type of analysis one is
doing.





On 7/26/07, Joseph McCrary <joe.mccrary@gmail.com> wrote:
Note that the answers provided by Maarten and Ricardo may provide different
results. You'll want to be careful about missing data. -egen, rowtotal-
treats missing values as 0, while the solution provided by Maarten does not.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of P chrisman
Sent: Thursday, July 26, 2007 4:09 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: summing variables

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/

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