Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: adding observation of means of variables


From   Abhimanyu Arora <abhimanyu.arora1987@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: adding observation of means of variables
Date   Thu, 16 Feb 2012 12:52:44 +0100

Thanks very much indeed, Phil.
Best regards
Abhimanyu

On Thu, Feb 16, 2012 at 12:45 PM, Phil Clayton
<philclayton@internode.on.net> wrote:
> Not as far as I know, but it's easy to program. Here's one solution:
>
> preserve
> collapse (mean) *
> tempfile means
> save `means'
> restore
> append using `means'
>
> The above assumes that all variables are numeric. If they're not, you could replace:
> collapse (mean) *
> with:
> ds, has(type numeric)
> collapse (mean) `r(varlist)'
>
> Phil
>
> On 16/02/2012, at 10:33 PM, Abhimanyu Arora wrote:
>
>> Dear statalist
>> Is there a direct command that appends an observation to the dataset,
>> giving the means of all the numeric variables?
>> Perhaps I am using -findit- not that efficiently, but if I am not
>> mistaken there was one...
>> Cheers
>> Abhimanyu
>> *
>> *   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/

*
*   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   |   Site index