Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: adding observation of means of variables
From
Phil Clayton <[email protected]>
To
[email protected]
Subject
Re: st: adding observation of means of variables
Date
Thu, 16 Feb 2012 22:45:54 +1100
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/