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

RE: st: AW: AW: sum of many variables

From   "Nick Cox" <>
To   <>
Subject   RE: st: AW: AW: sum of many variables
Date   Tue, 27 Oct 2009 14:00:09 -0000

As the order of variables is quite immaterial to their sum, another
possibility is to use a wildcard such as -x*-. As always you need to
check that it picks up exactly what you want and no more. 


Andrea Rispoli

Thank you very much!

On Mon, Oct 26, 2009 at 7:54 PM, Martin Weiss <> 
> Note, however, that there is a hazard involved when specifying a
> that encompasses all variables between "x1" and "xn" via the dash
> The number of variables between them changes with the -sort- order, as
> after -describe- (see [U], page 101, example 14). So next time you run
> code, the result could be different. Issuing an explicit -sort- or
> could save you trouble.
> Also note that the -sum()- function would give you a running sum, and
> accepts only a -varname-, not a -varlist-...
Martin Weiss

> *************
> egen x=rowtotal(x1-xn)
> *************

Andrea Rispoli

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

*   For searches and help try:

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