Statalist


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

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


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: st: AW: AW: sum of many variables
Date   Mon, 26 Oct 2009 20:20:59 +0100

<> 


Very true, thanks for pointing it out! One either -order-s columns or
-sort-s rows, not both as I implied. In her case, Andrea should -order-...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Austin Nichols
Gesendet: Montag, 26. Oktober 2009 20:20
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: AW: AW: sum of many variables

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/


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



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