Iwan Barankay
>
> I am frequently using the 'collapse' on my datasets and find it
> frustrating that I lose all my labels as they are replaced by
> something like
>
> (mean) oldvar
>
> is there a way to get around this, i.e. that the odl lables
> are kept
> somewhere and then be added to the variables after 'collapse' has
> been used.
> Any help and suggestions are very appreciated.
>
Yes.
1. Before -collapse-, copy the variable labels to local macros:
foreach v of var * {
local l`v' : variable label `v'
}
2. After -collapse-, use the old labels:
foreach v of var * {
label var `v' "`l`v''"
}
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/