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

st: labels


From   orozco <orozco@toulouse.inra.fr>
To   statalist@hsphsun2.harvard.edu
Subject   st: labels
Date   Mon, 21 Nov 2005 10:22:02 -00

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?

Thank you.

---------------------------------------
Valérie Orozco
Institut National de la Recherche Agronomique
Economie et Sociologie Rurales
Toulouse
---------------------------------------



===================================================================
EASY and FREE access to your email anywhere: http://Mailreader.com/
===================================================================


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