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.
Nick
[email protected]
Andrea Rispoli
Thank you very much!
On Mon, Oct 26, 2009 at 7:54 PM, Martin Weiss <[email protected]>
>
> 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-...
>
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:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/