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

Re: st: -collapse-


From   Ulrich Kohler <kohler@wz-berlin.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -collapse-
Date   Tue, 2 Mar 2004 15:39:07 +0100

Sascha O. Becker wrote:
> another labeling question:
> -collapse- automatically changes variable labels of collapsed variables
> to "report" what has been done in the -collapse-.
> While this is probably a good default option to keep you from messing
> things up and "warning" you that the collapsed data set is different
> from the original one, it might be useful in some other cases to keep
> the original variable label.
> As I understand it, there is no option to do this and one has to
> "manually" relabel the collapsed variable if one wants to "keep" the
> original variable label, right?

Yes, but something like

. foreach var of varlist v* {
	local lab`var': label var `var'
.}
. collapse (mean) v*, by(varname)
.foreach var of varlist v* {
.	 lab var `var' "`lab`var''"
.}

should work (not tested)

uli





-- 
kohler@wz-berlin.de
+49 (030) 25491-361


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index