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

st: RE: labels


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: labels
Date   Mon, 21 Nov 2005 11:00:40 -0000

One solution here is to use -label save- 
before the append and then use the 
created .do file afterwards. 

Nick 
[email protected] 

orozco
 
> I have 2 files with the same variables "name" and "color". Variable 
> "color" is an integer variable with a label, but the label is
> defined in each file, thus depending on the values of the variable
> "color" existing on each file. The problem is just that when I
> want to append the 2 files, I lose the labels of the values
> which are on the file I want to append, but which are not on the
> master data. I don't know how to do to append some label to the
> first label...maybe there is an easy way to do so (except to
> generate only one label first because I have a lot of files with
> the same variable already labelled)
> 
> Let's have an example :
> 
> data1 :
>   list
>      +-----------------+
>      |    name   color |
>      |-----------------|
>   1. | georges    blue |
>   2. |  robert     red |
>   3. |  simone    blue |
>      +-----------------+
> but in fact, variable color has a label :
> . label list
> typocolor:
>            1 blue
>            2 red
> 
> data2 :
>  list
>      +------------------+
>      |    name    color |
>      |------------------|
>   1. |  alfred      red |
>   2. | monique   yellow |
>      +------------------+
> . label list
> typocolor:
>            2 red
>            3 yellow
> 
> And when I do (on data1) "append using data2", I have :
> . list
>      +-----------------+
>      |    name   color |
>      |-----------------|
>   1. | georges    blue |
>   2. |  robert     red |
>   3. |  simone    blue |
>   4. |  alfred     red |
>   5. | monique       3 |
>      +-----------------+
> . label list
> typocolor:
>            1 blue
>            2 red
> 
> The value "3" which is not in data1 has no label after the append 
> command. Someone has an idea?

*
*   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