Statalist


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

st: RES: How to sum several scalars


From   "Henrique Neder" <hdneder@ufu.br>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RES: How to sum several scalars
Date   Mon, 12 Nov 2007 21:20:28 -0200

Dear Tiago

Try to execute this command:

scalar sum = statistc1 + statistc2 + statistc3 + statistc4 + statistc5 +
statistc6 + statistc7 
disp sum


or this routine:


scalar statistic1 = 1
scalar statistic2 = 2
scalar statistic3 = 3
scalar statistic4 = 4
scalar statistic5 = 5
scalar statistic6 = 6
scalar statistic7 = 7

scalar sum0 = 0
forvalues i = 1(1)7 {
local j = `i' - 1
scalar sum`i' = sum`j' + statistic`i'
}  

disp sum7

Henrique

-----Mensagem original-----
De: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Em nome de
tiago.pereira@incor.usp.br
Enviada em: segunda-feira, 12 de novembro de 2007 19:11
Para: statalist@hsphsun2.harvard.edu
Assunto: st: How to sum several scalars

Dear all,

Suppose I have 10 scalars, which contain some statistic of 10 variables.
These scalars are: statistic1, statistic2..... statistic10.

How one can sum a set of these scalars? I mean, let´s assume I want to sum
statistic3 to statistic7. Ho do one do that?


Tiago

P.S. I would like to thank Kit and Joseph for their help on my last post.
Thank you very much.




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


__________ Informação do NOD32 IMON 2653 (20071112) __________

Esta mensagem foi verificada pelo NOD32 sistema antivírus
http://www.eset.com.br



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