I want to keep my variable labels after collapsing in stata. I found Nick Cox's solution not working for me. The code looks like this: Before -collapse-, copy the variable labels to local macros:
foreach v of var * {
local l`v' : variable label `v'
}
After -collapse-, use the old labels:
foreach v of var * {
label var `v' "`l`v''"
}
All my variables after collapsing still have no labels.