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

st: RE: summing variables

From   "Joseph McCrary" <>
To   <>
Subject   st: RE: summing variables
Date   Thu, 26 Jul 2007 17:57:26 -0400

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-----
[] On Behalf Of P chrisman
Sent: Thursday, July 26, 2007 4:09 PM
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?

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index