Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Combining value labels, appending


From   Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Combining value labels, appending
Date   Thu, 12 May 2011 00:11:23 -0400

Dear Statalist

Is there a way to combine two value labels into a single one? Suppose
I have two value labels:

label list numbers1

1 One
2 Two
...
15 Fifteen

label list numbers2

16 Sixteen
...
30 Thirty

and I want to combine them into a single value label, numbers

1 One
2 Two
...
30 Thirty

The issue that motivates the previous question is the following: I am
appending two datasets with the same variable, which have a value
label with the same name attached. However, the labels are not the
same because they have different number-label assignments that
overlap, i.e

use data1, clear
label list label1

1 One
2 Two
3 Three

use data2, clear
label list label1

2 Two
3 Three
4 Four

and I want to append the datasets, keep label1 attached to the
original variable and update label1 so it ends like

label list label1

1 One
2 Two
3 Three
4 Four

Of course this should only work if the labels coincide for the numbers
that overlap. Is there a way to do this automatically?

Thank you,

_______________________
Jorge Eduardo Pérez Pérez

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index