Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Calculating means not using "collapse"


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Calculating means not using "collapse"
Date   Fri, 17 Jan 2003 17:21:13 -0000

David Greenberg
> 
> It seems to me that if your concern is with the 
> disappearance of the original variables from the data set, 
> one could generate a new variable equal to the old one, and 
> use collapse with the new variable. The original variable 
> will then still be preserved. 

Sorry, I don't understand this suggestion. Having 
a clone of a variable nearby doesn't inhibit a -collapse-, 
with its inevitable loss of information, 
nor should it. 

That is, suppose I 

. gen mpg2 = mpg 
. collapse mpg, by(rep78) 

The -mpg2- disappears along with 
everything else. All that is left 
is one value for each group of -rep78- 
and the group statistics (means) of 
-mpg-. 

Or am I missing something? 

Nick 
[email protected] 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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