Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: variable labels lost due to reshape

From   "Ada Ma" <>
Subject   Re: st: variable labels lost due to reshape
Date   Wed, 14 Jun 2006 02:14:30 +0100

All the info you needed are actually in the help file for label.

After you have collapsed the data, the labels should still be
available.  You can check that by typing:

label dir

to check if the labels you used are still hanging around.  If they do,
you'd only need to attach them to the new variables you have created.
If you're unsure what are in each of the labels, say if you have a
label called jelena, you can type:

label list jelena

You can also write

label save using child

which would save all the labellings into a do file.   Even if the
labels are for whatever reason lost you can run the label save command
with your child dataset loaded up and then when you have your altered
data set loaded up or your mother data set loaded up, you just run the
do file to make the labels available again. You shouldn't need to do
what Joseph Coveney recommended.

On 6/13/06, Jelena Zurovac <> wrote:
Dear Statalist subscribers,

I am using Stata 9.  After I reshape my data from child-level to mother-level,
I lose all the variable labels.  This makes sense, since my reshape drops all
variables and creates new ones from them.  But, losing all the variable labels
is rather inconvenient.  How can I retrieve them?

I searched ths listserv, and couldn't find the answer.  I tried to use label
save, but this refers to label values, not variable labels.

It seems that there would be two ways to approach this:
- Force Stata to somehow keep the variable labels (I doubt this is possible)
- Use some efficient method of retrieving the labels from the original dataset
and applying after the reshape.

Your help is most greatly appreciated.

Jelena Zurovac
Graduate Student
Department of Economics
University of Washington, Seattle

*   For searches and help try:

Ada Ma
Research Fellow
Health Economics Research Unit
University of Aberdeen, UK.
Tel: +44 (0) 1224 553863
Fax: +44 (0) 1224 550926
*   For searches and help try:

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