Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: R: need to sum several variables in a row
From
"Carlo Lazzaro" <[email protected]>
To
<[email protected]>
Subject
st: R: need to sum several variables in a row
Date
Tue, 17 Dec 2013 15:22:20 +0100
Raffaele may want something like this:
---------------------------------------------------
egen Y=rowtotal(var1 var 2...var100)
----------------------------------------------------
If all the variables to be summed up via -rowtotal- have the same prefix
(i.e., var), Raffaele can make it simpler with a wildcard (i.e., asterisk):
--------------------------------
egen Y=rowtotal(var*)
----------------------------
Kind regards,
Carlo
-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Raffaele
Palladino
Inviato: martedì 17 dicembre 2013 14:19
A: [email protected]
Oggetto: st: need to sum several variables in a row
Dear statalist, Im dealing with a problem that will be very easy for most of
you but somehow the program keeps sending me error messages!
I have to calculate a new variable that is the total amount of money from
several variables, all displaied in a row. Rather than using the g =
var1+var2 etc... which could be annoying considering the amount of variables
and the fact that I have to repeat this command several times I was trying
to look on internet for a solution. From this statalist I found users who
suggested to use the command rowtotal but apparently I can`t use it on stata
11, my version. Is it correct? It keeps saying "unknow function rowtotal ()"
Could you please indicate me the right command to use? many thanks
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/