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

From |
"P. Wilner" <pwjeanty@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: How to sum several scalars |

Date |
Mon, 12 Nov 2007 21:36:30 -0500 |

On Nov 12, 2007 4:11 PM, <tiago.pereira@incor.usp.br> wrote: > 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. > I think the example below may do the job Tiago wants to do, though others may have a better solution for Tiago. ** Begin example **** * Create 10 scalars forv i=1/10 { scalar myscal`i'=`i'+3 di "scalar =", myscal`i' } * Or if you will scalar list * Now let's sum them local i=1 scalar mysum=0 while `i'<=10 { scalar mysum= mysum + myscal`i' local i=`i'+1 } di mysum ** End example ***** Hope this helps -- P. Wilner Jeanty, Post-doctoral researcher Dept. of Agricultural, Environmental, and Development Economics The Ohio State University 2120 Fyffe Road Columbus, Ohio 43210 (614) 292-6382 (Office) * * 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/

- Prev by Date:
**Re: st: string variable** - Next by Date:
**Re: st: Using multiple equations with Optimize()** - Previous by thread:
**st: st : how to simply estimate combinaison of parameters estimated** - Next by thread:
**st: Re: How to sum several scalars** - Index(es):

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