[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Austin Nichols <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: AW: AW: sum of many variables |

Date |
Mon, 26 Oct 2009 15:20:12 -0400 |

Martin Weiss <martin.weiss1@gmx.de> : Should be -order- order rather than -sort- order, right? One can also accumulate a varlist as a local v and then egen x=rowtotal(`v') (for example using the -unab- command). On Mon, Oct 26, 2009 at 2:54 PM, Martin Weiss <martin.weiss1@gmx.de> wrote: > > <> > > > Note, however, that there is a hazard involved when specifying a -varlist- > that encompasses all variables between "x1" and "xn" via the dash notation: > The number of variables between them changes with the -sort- order, as seen > after -describe- (see [U], page 101, example 14). So next time you run this > code, the result could be different. Issuing an explicit -sort- or -order- > could save you trouble. > > Also note that the -sum()- function would give you a running sum, and > accepts only a -varname-, not a -varlist-... > > > HTH > Martin > > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Martin Weiss > Gesendet: Montag, 26. Oktober 2009 19:45 > An: statalist@hsphsun2.harvard.edu > Betreff: st: AW: sum of many variables > > > <> > > > > ************* > egen x=rowtotal(x1-xn) > ************* > > > > HTH > Martin > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Andrea Rispoli > Gesendet: Montag, 26. Oktober 2009 19:46 > An: statalist@hsphsun2.harvard.edu > Betreff: st: sum of many variables > > Dear Statalisters, > > I would like to use the sum command, i.e. > > egen x= sum (x1, x2...xn) > > however since my n is a large number I would like to indicate that I > want the sum from x1 to xn without specifying all variables. > > Do you have any suggestions? > > Thank you very much in advance > > AR * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: Stata 11 error Stata matrices have not been cleared***From:*Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>

**AW: st: AW: AW: sum of many variables***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**References**:**st: sum of many variables***From:*Andrea Rispoli <andrea.rspl@gmail.com>

- Prev by Date:
**AW: st: AW: AW: sum of many variables** - Next by Date:
**st: New version of -bmjcip- on SSC** - Previous by thread:
**st: AW: AW: sum of many variables** - Next by thread:
**AW: st: AW: AW: sum of many variables** - Index(es):

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